Reputation: 89
Recently i've been scrapping by using selenium-webdriver in nodejs for a few days. so i have to find element has specific child element but i don't know how find it.
i have used following operator but it doesn't work
By.xPath("tr[contains(@class, 'datetime2')]")
following html
<table>
<tbody>
<tr style="bacrgound-color:#eee">
<td class="datetime2">
20:00
</td>
<tr>
<tr></tr>
<tr style="bacrgound-color:#eee">
<td class="datetime2">
21:00
</td>
<tr>
<tr style="bacrgound-color:#eee">
<td class="datetime2">
22:00
</td>
<tr>
<tr></tr>
</tbody>
</table>
i need to find only 'tr' that include element <td class="datetime2">
. not <tr></tr>
how find this element By using By.xpath()?? please help me
Upvotes: 1
Views: 531