问题
I am attempting to test several web pages built in Flex, and need to automate clicking on several videos through the Flash interface. I'm using Ruby and Watir-Webdriver, but I'm not sure how to interact with Flash using them.
Has anyone figured this out? I've tried using Sikuli, but have found it to be a little clunky and not very fast. Any ideas would be greatly appreciated.
回答1:
I will quote myself:
It is important to say that Watir CAN NOT control browser plugins like Java applets, Adobe Flash or Microsoft Silverlight.
From https://github.com/zeljkofilipin/watirbook/blob/master/about.md
回答2:
There is a way though. You can embed javascript into your ruby watir script.
It has worked for me
browser.execute_script <<-JS
Global.videoPlayer.sendEvent("play")
JS
Similarly you can do a pause or stop based on the controller on the player
Enjoy !!
来源:https://stackoverflow.com/questions/7434338/is-there-any-way-to-automate-the-testing-of-flash-within-web-pages-using-watir-w