href - How to find hyperlinks with XPath -
i've tried .//*[@id='post-31']/div/div/div/a[1] on input: <!-- language: lang-html --> <div class="entry-content"> <div class="myaccount"> <div class="user-profile-links"> <a href="http://store.demoqa.com/products-page/your-account/?tab=purchase_history">purchase history</a> | <a class="current" href="http://store.demoqa.com/products-page/your-account/?tab=edit_profile">your details</a> | <a href="http://store.demoqa.com/products-page/your-account/?tab=downloads">your downloads</a> </div> </div> </div> for example posted, there no root element id-attribute, explain why wouldn't work. xpath expression /div/div/div/a[1]/@href finds href first a-element.