gpt4 book ai didi

webdriver - RemoteWebdriver XPath 的问题

转载 作者:行者123 更新时间:2023-12-02 22:29:34 29 4
gpt4 key购买 nike

运行测试时不使用 RemoteWebDriver,仅使用 IWebdriver driver = new FireFoxDriver();

我可以很好地运行我的测试,查找元素,使用 XPath 表达式工作得很好,但是当我将设置切换为使用 RemoteWebDriver 时,我在测试过程中的某个部分出现错误。

我收到以下错误消息:

Attempting to find outbound radio input to click
2012-01-18 15:50:11,522 [Simple Test Driver] INFO SeleniumGridExample.Utils.EventLogger - The driver is a SeleniumGridExample.Utils.ScreenshotRemoteWebDriver
2012-01-18 15:50:11,522 [Simple Test Driver] INFO SeleniumGridExample.Utils.EventLogger - Screenshot saved with exception: Session [1326893314795] not available - []
2012-01-18 15:50:11,522 [Simple Test Driver] INFO SeleniumGridExample.Utils.EventLogger - The driver is a SeleniumGridExample.Utils.ScreenshotRemoteWebDriver
2012-01-18 15:50:11,522 [Simple Test Driver] ERROR SeleniumGridExample.Utils.EventLogger - Screenshot could not be saved: Unexpected error.

<html>
<head>
<title>Error 501 Method {"USING":"XPATH","VALUE":"//INPUT[CONTAINS(@ID, is not defined in RFC 2068 and is not supported by the Servlet API </title>
</head>
<body>
<h2>HTTP ERROR: 501</h2><pre>Method {"USING":"XPATH","VALUE":"//INPUT[CONTAINS(@ID, is not defined in RFC 2068 and is not supported by the Servlet API </pre>
<p>RequestURI='0_lsDirection_ctrl0_lsLegs_ctrl0_inpSelect')]"}GET /wd/hub/session/1326893314795/screenshot</p>
<p>
<i><small>
<a href="http://jetty.mortbay.org">Powered by Jetty://</a>
</small>
</i>
</p>
</body>
</html>

这里有人知道为什么我使用 RemoteWebDriver 会遇到此问题,但使用普通 IWebDriver driver = new FireFoxDriver(); 时却不会出现此问题

最佳答案

尝试使用//INPUT[@id=''] 。这必须有效。但最好尝试使用 css 选择器。 Selenium 在 IE 浏览器上使用 expath 选择器需要一些时间。

关于webdriver - RemoteWebdriver XPath 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8923412/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com