xpath - How to grab the actual name of the attribute/class within the brackets -
how name of class, in case 84
<div style="width: 50%;" data-test="84" class="test"></div>
so want contents of data-test
attribute
given:
<div style="width: 50%;" data-test="84" class="test"></div>
if want value of data-test
attribute, use:
/div/@data-test
or, if you're looking class
equal test
:
/div[@class="test"]/@data-test
or, if want value of data-test
attribute containing data-test
attribute:
//*[@data-test]/@data-test
and if none of these help, may want update question give better idea of you're looking for.
Comments
Post a Comment