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

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -