I need an xpath expression for my selenium tests to get this element:
<td class="label"> Order Date </td>
but not this one:
<td class="label"> Order Dates </td>
I tried these two:
"//*[text() = 'Order Date']"
"//*[text()[contains(.,'Order Date')]]"
But the exact match expression doesn't take the whitespace into account, and the contains expression also targets the element with an s
.
You need to use the XPath's normalize-space()
as in //td[normalize-space()="Order Date"]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With