Given an arbitrary amount nodes to select:
<root>
<foo>1</foo>
<foo>2</foo>
<foo>3</foo>
<foo>4</foo>
<!-- ... -->
<root>
How do I select every other foo so that I get foo[1], foo[3], ... ?
node() matches any node (the least specific node test of them all) text() matches text nodes only. comment() matches comment nodes. * matches any element node.
For example if both text fields have //input[@id='something'] then you can edit the first field xpath as (//input[@id='something'])[1] and the second field's xpath as (//input[@id='something'])[2] in object repository.
Try
/root/foo[position() mod 2 = 1]
No idea if it will work right, might need 0. I forget if position starts at 0 or 1
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