Reputation: 2193
I want to check the following (on ie8):
After clicking on a link, popup window is launched, then I want to check if flash content inside has loaded.
For some reason waitForPopUp does not work, it just keeps waiting and times out but I've solved it this way:
selenium.waitForCondition("selenium.getAllWindowTitles().length > 1;", "30000");
String windowID = selenium.getAllWindowTitles()[1];
selenium.selectWindow(windowID);
Then I want to check if the flash content is there before checking anything on it (webpage is very slow and the popup takes a while to show something)
selenium.waitForCondition("selenium.isElementPresent(\"//*[@id='flashcontent']\");",
"30000");
FlashSelenium flashApp = new FlashSelenium(selenium, "flashClient");
assertTrue ( flashApp.PercentLoaded() == 100 );
I've tried hundreds of ways to do this but none works, I've also tried to check if a text is present but nothing, always times out even if the webpage is completely loaded.
For some reason everything works OK if I execute step by step in the debugger :S
Upvotes: 4
Views: 1693
Reputation: 6402
I gave this a little more thought.
There is no way to test an object if it is truely loaded and the flash app is ready and initialized.
The only true way of letting selenium know the flash object is loaded and ready is for flash to use the ExternalInterface method and call a JavaScript function that will assign a var and then have selenium test that var on a timer.
Example<br/>
// in JavaScript
var isFlashLoaded = false;
function cbIsLoaded( ){
isFlashLoaded = true;
}
// in AS3
var retVal:int = ExternalInterface.call("cbIsLoaded");
Upvotes: 1