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.


Comments

Popular posts from this blog

angularjs - Showing an empty as first option in select tag -

qt - Change color of QGraphicsView rubber band -

c++ - Visible files in the "Projects" View of the Qt Creator IDE if using the CMake build system -