I have to capture image using webcam and save as profile image.
Below is the screenshot of my flash application
Below are the steps I have to perform:
- Click on allow
- click on capture
- click on save
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It only takes a minute to sign up.Sign up to join this community
In your case the flash allow button is the hardest part, because its not in the DOM, it is something outside of the browser. Something you cannot interact with with Selenium.
What I have done in the past is programmaticly take a screenshot of the desktop, look for a partial image (which is the button), return the coordinates of the button and then click on that location. Here is my code which I used for VB.Net, you should be able to port it to C#: https://github.com/nreijmersdal/CodedUI/blob/master/ImageLocator.vb
This is called Image-based Recognition Testing and there are frameworks that can do this for you.
For example you cab use the .Net version of Sikuli, which is a framework to find partial screenparts and interact with them. But I thought this was a bit heavy since it starts a Java Jetty server, since the original Sikuli is written in Java. It was more lightweight to write a very basic version myself. Still it would do the trick nicely.
Info about tool: http://www.adobe.com/devnet/flash/articles/flash_selenium.html
Haven't found for C#, try to read this Flash automation using Selenium RC
If the buttons are not done in Flash, I would recommend excluding the pop-up from tests altogether.
This can be achieved by setting the specific website to "Always allow" access to camera, using Flash Player Settings Manager under the tab "Website Privacy Settings". Of course, those settings are stored locally, so this configuration would need to be done as an extra step of testing environment setup process.