I have an html page with two links on it, with similar link text:
'Office of Records' and 'Brooklyn Office of Records'
If I use this xpath, it will find the second link: "//a[starts-with(.,'Brooklyn')]" - so far so good.
However, if use the same xpath but look for the first link (which starts with the word 'Office'), it doesn't work : "//a[starts-with(.,'Office')]" - 'Unable to locate element'
I tried using regex ('^Office'), but that didn't work. I tried 'contains' instead of 'starts-with', but that also didn't work since one string is a substring of the other.
Any suggestions welcome!
EDIT
I read the spec, and it is as I assumed it would work: if string1 starts with string2, it returns true: starts-with(string1, string2)
I mocked up some xml to test this in the online tester:
<?xml version="1.0"?>
<note>
<record>
<a>Office</a>
<a>Brooklyn Office</a>
</record>
</note>
I have found no way to point to the first node ('Office') through 'starts-with', or 'contains'