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?
I开发者_C百科f I copy it directly, it doesn't give a result. What else can be done in this regard?
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.
Locating elements with Selenium: http://seleniumhq.org/docs/04_selenese_commands.html#locating-elements
Locating tips/techniques: http://seleniumhq.org/docs/appendix_locating_techniques.html
精彩评论