0

I am looking at some HTML as follows

<tr>
  <td nowrap><a href=" ... " >some link</a></td>
  <td nowrap>col2</td>
  <td nowrap>col3</td>
</tr>

I plugged this into an xpath tester http://www.xpathtester.com/test and it refuses to run because the input is invalid.

Can I use xpath to select elements on the above input? I am using selenium to click on the link contained in the row where the third td element has a specific value and figured xpath would be an easy way to do it.

4

1 回答 1

1

当然。正确的 XPath 是//tr[td[3][.='col3']/td[1]/a<a>包含在第一个<td>中的<tr>那个也包含col3在第三个中<td>

于 2013-04-26T23:00:55.873 回答