开发者

Selenium: Can i test if a page loaded a flash app (ie a swf) properly?

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">
<PARAM NAME=quality VALUE="high">
<PARAM NAME=FlashVars VALUE="quizXML=http://localhost:3000/quizzes/371.xml?online=true&myURL=http://localhost:3000/assets/players/millionaire/&开发者_开发知识库amp;online=true">

<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&myURL=http://localhost:3000/assets/players/millionaire/&online=true" width="800" height="600" quality=high TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">
</EMBED>
</OBJECT>    

thanks - max


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:

    while ( flashApp.PercentLoaded() < 100 )
    {
        Thread.sleep(1);
    }

Hope that helps, Gergely.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜