【发布时间】:2013-10-08 21:22:06
【问题描述】:
我正在尝试将 Selenium Grid 与 Jenkins 一起使用。 当我使用服务器独立的 2.35.0 jar 启动 Selenium Hub 和 Node 时,一切正常。 但是,当我使用 Jenkins Selenium Grid 插件作为集线器时不起作用。
错误出现在这里:
driver = new RemoteWebDriver(新 URL (gridURL), 能力);
网格 URL 是 "http://localhost:4444/wd/hub"
能力是这样的:
DesiredCapabilities capabilities = DesiredCapabilities.firefox ();
capabilities.setPlatform ( Platform.LINUX );
抛出此异常:
org.openqa.selenium.WebDriverException: Error forwarding the new session new session request for webdriver should contain a location header with the session.
Command duration or timeout: 25.28 seconds
Build info: version: '2.35.0', revision: '8df0c6bedf70ff9f22c647788f9fe9c8d22210e2', time: '2013-08-17 12:46:41'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '3.8.0-31-generic', java.version: '1.7.0_40'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
作为 Hub,我使用 Jenkins Selenium 插件版本 2.3 作为节点,我使用 selenium-server-standalone-2.35.0.jar。
当我用浏览器打开http://localhost:4444/ 时,它显示:You are using grid 2.29.0
所以我下载了 selenium-server-standalone-2.29.0.jar 并让它作为集线器运行。该节点仍然是版本 2.35.0。
然后我有同样的例外。我尝试使用 2.29.0 的节点和集线器,但我的 Firefox 似乎太新了。
我搜索了几个小时,但没有找到有关此错误的任何信息。
编辑: Jenkins 安装的插件,2013 年 8 月 18 日起:https://wiki.jenkins-ci.org/display/JENKINS/Selenium+Plugin
开发者在两天后的 2013 年 8 月 20 日更新了插件:https://github.com/jenkinsci/selenium-plugin/commit/316eccdef608e855863cf04b1c240fa2c7b8b762
我不知道这是否会导致我的错误,但有可能。我还不知道如何做到这一点,但我将尝试从 github 上的源代码构建我自己的插件版本。
【问题讨论】:
-
你能告诉我们你的测试课吗?即,任何时候
WebDriver被实例化 -
我不确定我是否理解正确。 WebDriver 在被告知的代码被剪断之前直接被实例化。我调试了代码,当我尝试创建新的 RemoteWebDriver 时抛出异常。