4

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

hithwen
  • 2,154
  • 28
  • 46
  • Trying to do things other way: flashObj = document.getElementById('flashClient'); in firebug works. selenium.getEval("this.browserbot.getCurrentWindow().document.getElementById('flashClient');") returns null. selenium.getEval("this.page().findElement('id=flashClient');") throws an exception of element not found. Any guesses? – hithwen Jun 03 '11 at 09:31
  • maybe null because the object isn't created yet? – The_asMan Jun 03 '11 at 18:46
  • If wasnt loaded it would be null in firebug too, right? – hithwen Jun 06 '11 at 11:48
  • Not sure about firebug. FireBug may be just displaying what is supposed to be in there. Try putting a few second delay in the script before it trys to do anything with the flash object. See if that helps – The_asMan Jun 06 '11 at 15:32

1 Answers1

1

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");
The_asMan
  • 6,364
  • 4
  • 23
  • 34
  • Ok, so I'll need to ask the dev team to include something like that in their code...Lets see how much time do I need to teach these old dogs a new trick :p. Thanks! – hithwen Jun 08 '11 at 07:21