Home > database >  How to locate title in html head with the title name XPATH
How to locate title in html head with the title name XPATH

Time:07-27

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']

i don't want full xpaths

please refer below image as well as this link-

enter image description here

CodePudding user response:

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']
  • Related