Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to locate title in html head with the title name XPATH

i am trying locate title in html head with the title name XPATH.

i have tried below xpaths but no luck/

i) //contains[@title=’Demo Script Test drive – PHPTRAVELS’]
ii) //head[@title=’Demo Script Test drive – PHPTRAVELS’]

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

i don’t want full xpaths

please refer below image as well as this link-

https://phptravels.com/demo

enter image description here

>Solution :

You can use the below xpath:

//title

there are 4 nodes in HTML-DOM, however if you use //title in driver.find_element(By.XPATH, "//title") command, it would point to the first node.

Also, you could try the below xpath:

//title[text()='Demo Script Test drive - PHPTRAVELS']
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading