pkk
pkk

Reputation: 379

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

i don't want full xpaths

please refer below image as well as this link-

https://phptravels.com/demo

enter image description here

Upvotes: 1

Views: 578

Answers (1)

cruisepandey
cruisepandey

Reputation: 29362

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

Upvotes: 2

Related Questions