Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Selenium webdriver 如何为此查找Xpath?_Selenium Webdriver - Fatal编程技术网

Selenium webdriver 如何为此查找Xpath?

Selenium webdriver 如何为此查找Xpath?,selenium-webdriver,Selenium Webdriver,还有没有。。如何识别xpath Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to find element with link text == More Details (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 421 millisecond

还有没有。。如何识别xpath

Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to find element with link text == More Details (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 421 milliseconds
通过给出xpath尝试了这种方法。。不走运。。org.openqa.selenium.InvalidSelectorException:xpath表达式“//*[@OnClick='selectTab(2,11,'MainTabControl','Panel','lblTitle','paneltitle','hfldSelectedTab')”]”无法计算或不会生成WebElement(警告:服务器未提供任何stacktrace信息)
命令持续时间或超时:157毫秒

尝试使用以下xpath:

//tr[@id='MainTabControl2']//td[@class='TabCaption']

//td[@class='TabCaption']

编辑:

如果存在相同的id和类,则可以使用元素的
text()
进行选择,如下所示:


//td[contains(text(),'**更多详细信息**')]

与更多详细信息一样,它有8个选项,所有选项都具有相同的id和类值。。它会工作吗?org.openqa.selenium.NoSuchElementException:无法找到xpath=//tr[@id='MainTabControl2']/td[@class='TabCaption'](警告:服务器未提供任何stacktrace信息)的元素命令持续时间或超时:380milliseconds@ChanGan请检查我编辑的答案。另外,请检查您刚才发布的xpath//td[contains(text(),'More Details')]是否正常工作
Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to find element with link text == More Details (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 421 milliseconds
//*[@OnClick='selectTab(2, 11, 'MainTabControl', 'Panel', 'lblTitle', 'paneltitle', 'hfldSelectedTab')']