I am currently trying to use xpath to locate the element for my selenium project, why is that when I try to run the selenium it is unable to locate the element with a relative path even though it's unique to the DOM? My goal is to use the title attribute of a div tag to locate the element since the div tags are very dynamic.
Absolute Path
/html[1]/body[1]/div[2]/div[8]/div[1]/div[3]/div[5]
Relative Path that is unique
//*//div[@title='This is the title ']
Have you tried to use
//*[@title='This is the title ']
Instead of
//*//div[@title='This is the title ']
Indeed, //*
directly locate the element in all child nodes.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.