shoaib
shoaib

Reputation: 31

Regarding XPath

When i am checking an XPath of a link, it appears to be:

id('content')/x:table/x:tbody/x:tr/x:td[2]/x:table/x:tbody/x:tr[2]/x:td[1]/x:table/x:tbody/x:tr[2]/x:td/x:table/x:tbody/x:tr[2]/x:td/x:table/x:tbody/x:tr[1]/x:td/x:table/x:tbody/x:tr/x:td/x:table/x:tbody/x:tr[2]/x:td/x:table/x:tbody/x:tr/x:td[4]/x:a[2]

How can I use it in in target?

If I copy it directly, it doesn't give a result. What else can be done in this regard?

Upvotes: 2

Views: 251

Answers (1)

Dave Hunt
Dave Hunt

Reputation: 8223

With Selenium, if the locator starts with // then it is assumed that the locator is an XPath, in your case the you will need to precede your locator with xpath= to make it explicit.

That said, your XPath looks very fragile. You might find that one of the other supported locator types would be more suitable, or a simplified XPath.

Upvotes: 3

Related Questions