Getting Attribute using xpath in selenium -


i have been looking xpath code value of attribute of html element part of regression testing. can please help

the attribute value dynamic changes every next webelement

below html code

<figcaption id="recentvideosvideoname0" data-videono="xza6fj32twe2gqyeubhjnq==" title="test test" class="caption">test test</figcaption> 

i want attribute : data-videono

i have tried this

by.xpath(("//div[contains(@id,'recentvideos')]/div/a/figure/figcaption")); 

here answer question:

to retrieve attribute data-videono can consider use following line of code:

string my_attribute = driver.find_element_by_xpath("//figcaption[starts-with(@id, 'recentvideos') , @title='test test']").getattribute("data-videono"); 

let me know if answers question.


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -