Xpath includes startup - no work

I am stuck in a problem with xpath expression. Can someone help me please?

So my xpath is ".//td[starts-with(text(), 'IMT - Office Admin:')]"

DOM:

<td>
 <input type="checkbox" name="partyEditF:j_id698:6:j_id700">
                IMT - Office Admin: Ability to edit everything within your office including the office information and listings
</td>
+4
source share
1 answer

Yours XPathdoesn't work, because actually the text starts with spaces / newline characters, so you need to get rid of them. Try below expression

.//td[starts-with(normalize-space(.), 'IMT - Office Admin')]
+4
source

Source: https://habr.com/ru/post/1671066/


All Articles