Why not use this XPath example?

I am trying to find the first element <th>under the element <table>. The table element is tagged with a specific identifier and is available for localization when I look only at this tag.

But when I try to go a little further and search using XPath below, it returns a null element. '/th[0]'should say: return the first element <th>under the element marked with a specific identifier.

In this example, the id value is populated before the search:

"// * [@ id = '{0}'] / th [0]"
+3
source share
1 answer

XPath names are based on 1. Try: //*[@id='{0}']/th[1]

It turns me on too; too much time spent with indexing based on 0 in C, C ++, etc.

+4
source

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


All Articles