tags:

views:

389

answers:

3

Hey, I'm trying to hit a link in a table-row that contains multiple links. This pattern is used throughout the table.

This works:

browser.wait_for(:element => "css=tr:nth-child(1) li:nth-child(2) > a")

This does not:

browser.click "css=tr:nth-child(1) li:nth-child(2) > a"

Any ideas why this might be? I'm using the selenium-client rubygem.

+1  A: 

Hey Rodreegez,

I suspect this is due to a bug in cssQuery, which Selenium currently uses to locate elements by CSS. Details of the issue and a patch can be found in the comments of the following issue: http://jira.openqa.org/browse/SEL-698

Hope that helps - I believe Selenium 2 will be using a different library for CSS locators - possibly JQuery's Sizzle (http://sizzlejs.com/), which should solve this problem.

Dave.

Dave Hunt
A: 

To avoid painful CSS issues like this, I've installed jQuery as a user extension. It gives the ability to define a locator String similar to CSS ("jquery=td.dt-col-status div.dt-liner:contains('Complete')") that is much more powerful. I can expand on how I did it for the Java RC if you'd like.

dhackner
A: 

Hi dhackner.

I'd like to try adding jQuery as user extension and providing a new selector that uses jQuery for locating. Could you please give me more informations on how you did that?

Kind regards,

Christoph.

cdamm
this should probably be a comment on dhackner's answer.
Rodreegez