I am trying to write some software for automated testing of flash contained within webpages.
Specifically I am looking for assistance with 'hooking' onto a webpage which is running the flash and gaining access to the controls and events it uses so that I can simulate button clicks and then listen for the responses it produces.
Since it could be any flash movie running, I need to be able to gain access to the controls so I can try and make an educated guess as to which ones I need to simulate clicking.
I need it to be free or perhaps open source hopefully with examples ideally in a .net technology.
Can anyone offer assistance or examples, please?
Many thanks
There is Ruby library called FlashWatir. Not exactly what you were looking for, but close.
First, Flash pages can be manipulated with JavaScript. For a reference on this see: http://www.adobe.com/support/flash/publishexport/scriptingwithflash/scriptingwithflash_06.html
You can write something in C# or use Selenium (open source) to test the whole thing with some scripting. Selenium Remote Control has support for DotNet.
Selenium Remote Control
http://seleniumhq.org/projects/remote-control/
Tutorial on using Selenium to test Flash:
http://wiki.openqa.org/display/SRC/Testing+Flash+with+Selenium+RC
Hope this helps.
Related
I'm looking to make a C# application to automate some processes for me. One of which would be navigating a few websites that I frequent, such as grooveshark. I'd like my application to be able to log me into the website and search for/play a song.
I've done some googling on the topic and came across something called selenium. I was wondering if this was the best tool for what I would like to accomplish or if there is another option that would be a suit my needs better?
Thanks in advance!
In order to automate your process , you can use Microsoft Test Manager , who is tool about testing and generating code
On Microsoft Test Manager 2012 , for example you have new functionnality such as Exploratory Test, the process is you explore your application and generate your test.
Link : http://msdn.microsoft.com/en-us/library/vstudio/hh191621.aspx
After creating your tests, you can generate Coded UI Test and include in your build process
Note : you must use Team Foundation Server or Service in order interact with Test Case WorkItem
Selenium will do fine, unless the sites use Flash. If they do, you are pretty much stuck.
https://code.google.com/p/selenium/
http://selenium.googlecode.com/git/docs/api/dotnet/index.html
http://docs.seleniumhq.org/docs/03_webdriver.jsp
I would read up on Selenium and come back when you have a specific problem.
If you have Visual studio Premium or greater I would suggest Coded UI. I would also suggest CUITe http://cuite.codeplex.com/ as it simplifies the code.
It definately depends on what your automation is going to be able to. I don't know Selenium at all. I think it's for recording certain actions on a website in a certain order. Though you will only be able to automate the process as far as the website (the actual client) capabilities offer.
If you'd like to build some different, more advanced behaviour the client doesn't provide yet, you'd need to build your own client. That'd need some backwards engeneering. That'd be the case for e.g. automating browser games. Usually a browser game client doesn't provide scanning certain amounts of players and automatically comparing them to your own player profile, so building this feature on your own would be the only possible solution.
Hi all I used Selenium some time ago to create a program to carry out automated actions on a website I enjoy using.
I managed to use Selenium to do what I wanted before without much trouble the only issue I had was using it in the background.
I couldn't use it without it effecting other things I was doing on the PC, I did think of using virtual machines but I would like to try and avoid this.
Last night I was playing around with the WebBrowser class in C# and its nice but limited, I like how it was self contained within the windows form application so this is what I am looking for.
Dose anyone know the best way integrating a visual representation of a browser within a windows form application but still allow me to mimic key entry etc but would run in the background.
I have heard of things like WaitN, GekoFX, MozNet etc but from what I read I am not sure any of these would work.
In general, when you are attempting to automate a web page using a browser, you have two options for simulating user events. You can either simulate them via JavaScript, or you can use OS-level mechanisms (so-called "native events") for simulating mouse and keyboard events. Both approaches have their pitfalls.
Simulated events using JavaScript only would probably allow the window being automated to remain in the background, without system focus, while carrying out the tasks you desire. Selenium RC used this method, and Selenium WebDriver offers the ability to use simulated events for Firefox and IE. However, there are some drawbacks to this approach. Simulated events may lack the fidelity and accuracy you require. For example, "drop-down menus" on a page that work via the CSS :hover pseudoselector cannot be triggered via JavaScript, so this approach is doomed to failure in these cases. Additionally, since you're using JavaScript, you're restricted to the JavaScript sandbox, which means that cross-domain frames and the like may be strictly out of bounds.
Native events, on the other hand, are far more closely representational of a user's actual mouse and keyboard operations. In general, they'll allow the correct events to fire on the web page, and in the correct order, without you having to guess which events to fire on which elements. The downside to using them is that to implement them correctly, the window being automated must have the system focus to receive the events properly. You can attempt to hack around this using the SendMessage API if you're on Windows, but this is the Wrong Thing to do, as it's error prone and absolutely not guaranteed to work. The correct way to use native events is to use the SendInput API, but that API sends the input to the window with the system focus. WebDriver defaults to using native events for simulating user input, but it defaults to the flawed SendMessage approach. For IE, at least, it does provide an option to use the more correct SendInput approach.
If you're dead set on not requiring a browser window in the foreground, you really ought to look into a headless option. PhantomJS is a great option, and WebDriver also has a driver for it, which means you can still write your automation code in C#. Otherwise, you're limited to one of the other approaches outlined above.
Does the application need to be hosted within a window?
I have used selenium, Watin for automation, unfortunately they do interfere with what you are doing and I have not managed to find a way around this.
I have used the .Net WebBrowser class too, but for automating I am not sure without testing if it is a fully featured IE, with regard to JavaScript running inside it. I think it does execute JavaScripts though, but you would need to check.
If you do not need to see what is happening there are headless options available too, even for Selenium I think:
Is it possible to hide the browser in Selenium RC?
Here is a list of headless versions if that is viable for you:
https://gist.github.com/evandrix/3694955
From https://learn.microsoft.com/en-us/visualstudio/test/use-ui-automation-to-test-your-code?view=vs-2022
Visual Studio 2019 is the last version where Coded UI Test will be
fully available. We recommend using Playwright for testing web apps
and Appium with WinAppDriver for testing desktop and UWP apps.
Consider Xamarin.UITest for testing iOS and Android apps using the
NUnit test framework. To reduce the impact on users some minimum
support will still be available in Visual Studio 2022 Preview 4 or
later.
I am writing my own GUI with .NET (C#) and I want to use a python script to click buttons for me automatically and read from text boxes etc. I've tried the Google searches but nothing really helpful. Is there a library that I need to download for .NET or is there a module in python that will do what i"m looking for. I'm sure it can be done, I just don't know where yo start
I have used AutoIt in the past for GUI testing where I needed to actually test the GUI controls.
http://www.autoitscript.com/site/autoit/
It sounds like you might be looking for a test automation tool, to script GUI events. I looked into using Ranorex for that a while back, and it looked very capable, but it was too expensive and overkill for my needs.
I think it's possible to somehow hook with the windows environment (specifically explorer.exe) and trigger specific things, for example launching control panel and using it as if I had mouse (meaning I'm clicking the interface from the code).
Basically what I'm trying to do is automate some redundant tasks I do often, just I don't know how it's done, or even how it's called. Anyone can point me in right direction?
Thanks!
Forget about "automated clicking". GUI tools are just front-ends to control the system. You can control the system like they do, it will be much easier.
Huge possibilities can give you Microsoft Management Console. Each "snap-in" can be accessed via COM model. Some of them have GUI front-ends, find and fire "*.msc" files (somewhere in Windows directory) to try them.
There is many command line tools i.e. "net" command has huge abilities related to networking.
PowerShell may be a better choice instead of C# or C++, it's designed for task automation. You can easily use COM, .NET, MMC ...
Windows Explorer has a COM object model that you can call from both C# and C++. (Most of the examples on MSDN are in Javascript or VBScript, which I guess aren't your languages of choice, but they demonstrate that the API is straightforward to call.)
AutoHotKey is a scripting environment specifically designed for this sort of task
If you want mostly to launch control panel you can do using RunDll32 interface existing in the most control panel applets. See http://www.osattack.com/windows-7/huge-list-of-windows-7-shell-commands/ , http://support.microsoft.com/kb/167012 or http://www.winvistaclub.com/t57.html for example. For the corresponding API see http://support.microsoft.com/kb/164787.
Another option is usage of control.exe (see http://msdn.microsoft.com/en-us/library/cc144191.aspx and http://vlaurie.com/computers2/Articles/control.htm).
If you google more you will find much more examples which you can to automate a lot of things without using of some general ways to automate GUI.
At more or less the lowest level within Win32, you can use the SendMessage() API to send raw click messages to windows of interest. This will rely on a lot of intrusive knowledge about the apps you intend to drive. However, you could easily implement a "click recorder" that could replay click sequences captured from user interaction.
we are tasked with basically emulating a browser to fetch webpages, looking to automate tests on different web pages. This will be used for (ideally) console-ish applications that run in the background and generate reports.
We tried going with .NET and the WatiN library, but it was built on a Marshalled IE, and so it lacked many features that we hacked in with calls to unmanaged native code, but at the end of the day IE is not thread safe nor process safe, and many of the needed features could only be implemented by changing registry values and it was just terribly unflexible.
Proxy support
JavaScript support- we have to be able to parse the actual DOM after any javascript has executed (and hopefully an event is raised to handle any ajax calls)
Ability to save entire contents of page including images FROM THE loaded page's CACHE to a separate location
ability to clear cookies/cache, get the cookies/cache, etc.
Ability to set headers and alter post data for any browser call
Process and/or thread safe would be ideal
And for the love of drogs, an API that isn't completely cryptic
Languages acceptable C++, C#, Python, anything that can be a simple little background application that is somewhat bearable and doesn't have a completely "untraditional" syntax like Ruby.
From my own research, and believe me I am terrible at google searches, I have heard good things about WebKit... would the Qt module QtWebKit handle all these features?
You might try one of these:
http://code.google.com/p/spynner/
http://code.google.com/p/pywebkitgtk/
I know you mentioned you don't like Ruby syntax (neither do I), but I just have to chime in and say that Watir is probably the best thing out there for what you are trying to do.
EDIT: There appears to be a Java counter-part called Watij
I've only been digging into this recently myself, so I couldn't say that this does everything you've listed, but check out GeckoFx.
From the site: GeckoFX is an open-source component which makes it easy to embed Mozilla Gecko (Firefox) into any .NET Windows Forms application. Written in clean, fully commented C#, GeckoFX is the perfect replacement for the default Internet Explorer-based WebBrowser control.
As for my own impressions: it has blown away the default .NET WebBrowser in both performance and stability.