tags:

views:

118

answers:

2

hi all. I'm writing some selenium tests (in rspec for a rails app). One of my pages loads a swf and while i don't want to test the functionality of this flash app i do want to test that it loaded up ok. Is this possible?

In case it helps, the html to load the swf is:

<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="800" height="600">
<PARAM NAME=movie VALUE="http://localhost:3000/assets/players/millionaire/millionaire.swf"&gt;
<PARAM NAME=quality VALUE="high">
<PARAM NAME=FlashVars VALUE="quizXML=http://localhost:3000/quizzes/371.xml?online=true&amp;myURL=http://localhost:3000/assets/players/millionaire/&amp;online=true"&gt;

<param name=width value="800">
<param name=height value="600">
<EMBED src="http://localhost:3000/assets/players/millionaire/millionaire.swf" FlashVars="quizXML=http://localhost:3000/quizzes/371.xml?online=true&amp;myURL=http://localhost:3000/assets/players/millionaire/&amp;online=true" width="800" height="600" quality=high TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"&gt;
</EMBED>
</OBJECT>    

thanks - max

+1  A: 

I think you can interact with flash objects using javascript, so you could use selenium.getEval("script").

There is also this component for testing flash http://www.adobe.com/devnet/flash/articles/flash_selenium_print.html

01
+1  A: 

Hi!

Yes you can. Take a look at flash-selenium. http://code.google.com/p/flash-selenium/

There is a little function called percentLoaded.

assertEquals(100, flashApp.PercentLoaded());

You can write a simple for cycle to wait for it to give back 100.

Like:

[code] while ( flashApp.PercentLoaded() < 100 ) { Thread.sleep(1); } [/code]

Hope that helps, Gergely.

Hannibal
Thanks Gergely, i'll check that out.
Max Williams