I am using LocateAll to find instances of an element on the page. I am using CSS as the primary way to locate my elements due to them being faster than xpath.
The following is the html:
<tbody xpath="1"><tr>
<th></th>
<th>
PhoneNumber
</th>
<th>
Address
</th>
<th>
Id
</th>
<th>
Gender
</th>
<th>
Nickname
</th>
<th>
Shipping
</th>
<th>
Closed
</th>
</tr>
</tbody>
I want to grab all instances of "th". I am using the following method:
* def headerCount = karate.sizeOf(locateAll('tbody tr th'))
However, I am getting the following error:
org.graalvm.polyglot.PolyglotException: js eval failed twice:document.querySelector("tbody tr th[2]")['textContent'], error: [type: MAP, value: {type=object, subtype=error, className=DOMException, description=DOMException: Failed to execute 'querySelector' on 'Document': 'tbody tr th[2]' is not a valid selector.
I am assuming LocateAll works by indexing the locator to find all instances? If so, can I go an alternative route if possible (I'd rather not use xpath)?