I'm attempting to get an a
link on a webpage where I know the class name of the element, but the title on each row in a table is different.
For ex.
Row A might look like
<a href='/someaddress' class='constantClassName' title='AlwaysPresentText - Row <somenumberhere_oneormoredigits> - TextIKnowAheadOfTime'>Edit</a>
In Chrome devtools I've got
//a[@class='constantClassName' and contains(text(),'Edit') and starts-with(@title,'Edit')]
which gets me mostly there.
What I can't seem to get to work is appending ends-with(@title,'TextIKnowAheadOfTime')
to work. In my use case, contains(text(),'sometext')
may return more than one result so I need an exact match.
Using Java here, and would using a Java regex concatenated with my desired string be the fastest way to go, or is there an xpath query way to obtain a single result by exact match of the ends-with()
?