Reputation: 848
I have one tag :
<span class="abc pqr and xyz">
Now I want to identify this tag in DOM with the help of xpath
.
I have tried this:
//span[contains(@class,'abc pqr')].....
Here and
term is frequently change.Just abc,pqr,xyz
are constant.
How can I identify this element with use of all three set value.???
Upvotes: 0
Views: 57
Reputation: 9520
You can combine several contains
queries with an 'and' operator:
//span[contains(@class, 'abc') and contains(@class, 'pqr') and contains(@class, 'xyz')]
If the classes are always in certain positions or always together, you could go for:
//span[contains(@class, 'abc pqr') and contains(@class, 'xyz')]
Upvotes: 1
Reputation: 1515
You can try:
//span[starts-with(@class,'abc pqr')][ends-with(@class, 'xyz')]
or:
//span[starts-with(@class,'abc pqr') and ends-with(@class, 'xyz')]
Upvotes: 2