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

C# random value from dictionary and tuple -

cgi - How do I interpret URLs without extension as files rather than missing directories in nginx? -

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