Reputation: 17839
I have this table inside another table inside another table and so on. And then I want to get the text value of the td element with a specific class.
<tr>
<td width="5%"></td>
<td class="wintxt">The XML ....<br/><br/>Number: xyz</td>
</tr>
I need to get the text content "The XML ....Number: xyz"
I tried using:
List<?> submissionString = resultOfsubmissionPage.getByXPath("//tr[@class=\"wintxt\"]/td/text()");
...and many other variations but I always get a zero element List. Anyone has a clue?
Upvotes: 0
Views: 937
Reputation: 23805
There is mistakes with your provided xpath
you are searching text()
in that row means tr
which has class attribute but as your provided HTML only one td
has class attribute. So try as below :-
List<?> submissionString = resultOfsubmissionPage.getByXPath("//tr/td[@class='wintxt']/text()");
Hope it helps..:)
Upvotes: 2