Selenium: cannot find link in table

I am writing a Selenium script. There is a table for the html page, I cannot use "css = table tr: nth-child (2) td: nth-child (3) a" to find the link in the table. The Selenium IDE gives me a "locator [error] not found".

But use "css = table tr: nth-child (2)", it can find the line. So I'm wrong for the css locator, I think adding "td: nth-child (3) a" should work for the link in td, why not?

Edit: I am using firefox 3.0.15

+5
source share
2 answers

Given HTML:

<html>
  <body>
    <table>
      <tr><td>Hello</td><td>World</td></tr>
      <tr><td>I'm</td><td><a href="http://www.example.com/">Batman</a></td></tr>
    </table>
  </body>
</html>

You can use the following locator to reference in the second column of the second row:

css=tr:nth-child(2) > td:nth-child(2) > a

Update:

, , , - cssQuery, Selenium (http://jira.openqa.org/browse/SEL-698). , . , , cssQuery , , .

+8

Selenium IDE 2.1.0

-, , URL-.

, , 25- ...

<tr>
<td>
<div align="center">
<font color="#FFFFFF">
<a target="_blank" href="http://[The link I need to test] ... 

assertElementPresent  //*[starts-with(@href,'The Link')]

assertElementPresent  //*[contains(@*,'The Link')]

, - . .

0

All Articles