Reputation: 31
I have a table with dynamically generated rows that have ids like the following
id='cu1111-co23466-t1-a23456'
id='cu1111-co23466-t2-a3246'
id='cu1111-co23466-t3-a265873'
id='cu1111-co23466-t3-a0985'
id='cu1111-co23466-t2-a3274'
How can I select multiple <tr>
elements using wildcards? Say I wish to select all <tr>
elements that have cu1111-co-23466-t2
in their id... I wish to do something like..
//*[@id='cu1111-co23466-t2-a*']
But its not selecting any rows. I am using the Developer Tools Console in Chrome to do the check. It gives me error:
Error: INVALID_EXPRESSION_ERR: DOM XPath Exception 51
I think I have XPath 1.0 . Is there any way to check what version I have and how to upgrade it?
Upvotes: 1
Views: 741
Reputation: 241858
If the wildcard isn't in a middle of the string, you can try
//@id[contains(., 'cu1111-co23466-t2-a')]
You might also use the starts-with
function.
Upvotes: 2