2

I have to capture image using webcam and save as profile image.

Below is the screenshot of my flash application

enter image description here.

Below are the steps I have to perform:

  1. Click on allow
  2. click on capture
  3. click on save
1
  • 3
    Use a tool to automate Windows GUI, such as AutoIT
    – FDM
    Commented Apr 2, 2016 at 5:46

3 Answers 3

1

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.

0

Link for Java solution http://toolsqa.com/selenium-webdriver/testing-flash-selenium-flash-javascript-communication/

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

1
  • 1
    Could you please provide context to your answer beyond only a link that way when/if the link goes dead the Answer will still be valid?
    – Paul Muir
    Commented Apr 25, 2016 at 15:14
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.