Flash Automation Using Selenium Web Driver

We are trying to automate a Flex-based web application using the Selenium web driver. We are amazed here when we learn that we need to rely on third-party extensions to do this.

We examined several options, for example:

1.Robot Framework

2.sfapi

But the problem found: drag and drop using doFlexDragTo(id:String, pos:String) does not work. http://code.google.com/p/sfapi/issues/detail?id=7

We really need this feature working on its use in our application.

3. Now we are thinking about exploring the following (both are the same, I think) https://www.gorillalogic.com/monkeytalk/legacy-products and FlexMonkium

Please suggest us if there is a better option than the above. If someone has already done research on this or some way to automate Flex based on the Selenium web driver, please suggest.

+4
source share
2 answers

Try Sikuli . It should work in your case.

+4
source

Why not try the action?

Create an invisible button that you click on

((JavascriptExecutor) driver).executeScript("var mybutton = $('<button/>', {id: 'invisbutton', class: 'invisbutton',text: '', style: 'position:absolute; width:20px; height:20px;top:" + result_pos_y + "px;left:" + result_pos_x + "px;visibility:hidden'}); $('" + element_to_append + "').append(mybutton);");

result_pos_y and result_pos_x - int pixel values

element_to_append is a reference to a jquery web element

Scroll to a button and press it (e.g. play or pause button)

 Actions builder = new Actions(driver.getWebDriver()); builder.moveToElement(driver.findElement(By.xpath("//button[@id='invisbutton']"))).build().perform(); builder.moveToElement(driver.findElement(By.xpath("//button[@id='invisbutton']"))).click().build().perform(); 

And insert your code with statements. In my case, I can reach some states of the Flash player through JS, so below is an example of my statement

 String brightcove_id = driver.findElement(By.xpath("//div[@id='bcplayer-container']//object")).getAttribute("id"); ((JavascriptExecutor) driver).executeScript("brightcove.api.getExperience('" + brightcove_id + "').getModule(brightcove.api.modules.APIModules.VIDEO_PLAYER).getIsPlaying( function(isPlaying) { alert(isPlaying)})"); driver.pause(200); String alert_text = driver.switchTo().alert().getText(); driver.switchTo().alert().accept(); assertTrue("Video is not stopped after clicking pause button", alert_text.equals("false")); 

Note that actions are supported in FF without adding your own events, but you need to add support for native events in Chrome.

The only drawback of this method is that you need to create a mapping (pixel map of each flash element) for the buttons.

-1
source

All Articles