We are trying to automate a web application which has Flex based functionality using Selenium web driver. We are struck here as we learnt that we need to rely on third party extensions to get this done.
We explored few options like:
1.Robot Framework
2.sfapi
But found an issue: Drag and Drop using doFlexDragTo(id:String, pos:String)
is not working.
http://code.google.com/p/sfapi/issues/detail?id=7
We actually need this function working to use it in our application.
3.Now we are thinking of exploring the below (both are same i think)
https://www.gorillalogic.com/monkeytalk/legacy-products
and FlexMonkium
Please suggest us if there is a better option available other than the above. If someone have already did research in this or some route to handle Flex based automation using Selenium web driver please suggest.
Try Sikuli .
It should work in your case.
Why not trying Actions?
Create the invisible button you will 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
are pixels int values
element_to_append
is jquery webelement reference
Move to the button and click it (like 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 asserts. In my case, I am able to reach some Flash player states via JS, so below is the example of my assert
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 the Actions are supported in FF without adding Native events, but you need to add Native events support in Chrome.
The only disadvantage of that method is that you need to create mapping(pixels map of every flash element) for buttons.