tags:

views:

985

answers:

3

I'm trying to use Selenium IDE to click on a swf in a html page. The DIV id and Embed id change depend on the timestamp e.g. id="FLASH_0_23458974594", I've tried using id=/^FLASH_([0-9]+_)0-9/ or id="FLASH_glob:*" but the IDE is not picking up the swf. Am I doing something wrong here?

Thanks.

+2  A: 

Have you tried contains?

click | //object[contains(@id,'FLASH_')]
s_hewitt
I just did, and it didn't work. I got this error: [error] locator not found: //object[contains(@id,'FLASH_')], error = Error: Element //object[contains(@id,'FLASH_')] not found
JLau
Just saw that you are using embed tags. You might need to replace 'object' with 'embed'. Otherwise, can you add the relevant HTML from the page to your question.
s_hewitt
IDE able to detect it using embed, but it's not clicking it. In the log it shows - [info] Executing: |click | //embed[contains(@id,'FLASH_')] | | but it's not clicking it.
JLau
Looked around some more. Doesn't look like you are going to be able to click the Flash object within the Selenium IDE. You need to use Selenium RC and a plugin. http://clearspace.openqa.org/message/59114
s_hewitt
I actually do use Selenium RC, I was using the IDE to verify if it'd work or not. I'd seen the link you sent before, the problem is I'm actually working on AS2 and so the google code won't be able to do what I want. Thanks.
JLau
You could try executing some javascript on the page. Based on http://lifescaler.com/2008/04/simulating-mouse-clicks-in-javascript/ as long as you don't have to click a certain part of the SWF, just any part of the SWF, you should be able to get that to work. Otherwise since you are in using Selenium RC, you can send a mouse click from code, but you'd have to open a new question for that.
s_hewitt
+1  A: 

Clicking on the flash object won't work. The only known way to automate Flash using Selenium is to expose UI functions in the Flash object via JavaScript. Then you can call that JavaScript using the getEval() function in Selenium RC.

Patrick Lightbody
A: 

We use the Java client for selenium and sometimes have our tests use the Java Robot to move the mouse and click when we cannot interact with the web browser directly. This has downsides (such as the browser must be in the foreground and accuracy can be a bit tricky) but when running tests in a virtual machine these downsides are minimized.

Zugwalt