I have the following html:
<html>
<head>
<body>
<table>
<tr>
<td>Something Else</td>
<td>Something</td>
</tr>
<tr></tr>
</table>
</body>
The xpath expression for the first column of the first row:
/html/body/table/tbody/tr/td[2]
I would like to use selenium to get the value "2".
In other words, what is the meaning of the first appearance of the text “Something”. I can get selenium to recognize this element, but not return the value.
Edit: So far, there are excellent answers. But let me make it clear that this is more of a selenium issue, not an xpath issue. I need to figure out how to get selenium in order to return this value.
source
share