Reputation: 5622
I want to get the Xpath selector for classname(.class) . So basically, i want to know how I can select [attr~=value]
So if i have an element
<div class="class1 class2 class3"></div>
<div class="class1"></div>
I want to select .class1, it should return both the divs. [@class='class1'] doesn't work since it won't select the first div.
Upvotes: 4
Views: 807
Reputation: 1956
That trick should only find "class1":
//div[contains(concat(' ',normalize-space(@class),' '),' class1 ')]
Upvotes: 6