Ran into an interest limitation with Selenium today. I am trying to interact with an anchor tag/link. Trouble is that the link is one of several on the page that have similar names. The best way to get at it is via the id attribute, since they are dynamically generated and are unique (not that it matters, but the number appended to the text is a db ID). So, I figure I can use a regexp to evaluate the link so;
selenium.click("id=regexp:playMovie[0-9]*");
The [0-9]* should allow for any number of digits after the playMovie. However, when I evaluate the expression with isElementPresent, a big, fat false is returned. How could that be?
I thought perhaps my syntax was wrong, but I don't think it is. So, I tried something different. I tried another link and did this:
selenlium.click("link=regexp:Just [A-Za-z]*");
This should find the first instance of a link with "Just" as the first 4 characters followed by a space. Interestingly, this works. My syntax is correct, so what could the problem?
I have come to the conclusion that the regexp: modifier will not work with "id=" locator, although that doesn't make a lot of sense. I've seen examples on the web that seem to suggest some others have this working correctly.
Hopefully I'll have more on this as I figure it out.
Print | posted on Tuesday, March 10, 2009 9:08 AM