Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/334.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
Java 硒+;詹金斯:缺少位置标题_Java_Selenium_Jenkins - Fatal编程技术网

Java 硒+;詹金斯:缺少位置标题

Java 硒+;詹金斯:缺少位置标题,java,selenium,jenkins,Java,Selenium,Jenkins,我正在尝试与Jenkins一起使用Selenium Grid。 当我使用server standalone 2.35.0 jar启动Selenium Hub和Node时,一切都很好。 但是,当我使用Jenkins Selenium网格插件作为中心时,它不起作用 错误出现在此处: 驱动程序=新的RemoteWebDriver(新的URL(gridURL),功能) 网格URL是”http://localhost:4444/wd/hub“ 能力是这样的: DesiredCapabilities cap

我正在尝试与Jenkins一起使用Selenium Grid。 当我使用server standalone 2.35.0 jar启动Selenium Hub和Node时,一切都很好。 但是,当我使用Jenkins Selenium网格插件作为中心时,它不起作用

错误出现在此处:

驱动程序=新的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
作为中心,我使用Jenkins Selenium插件版本2.3 作为节点,我使用selenium-server-standalone-2.35.0.jar

当我打开
http://localhost:4444/
在浏览器上显示:
您正在使用grid 2.29.0
所以我下载了selenium-server-standalone-2.29.0.jar并让它作为一个集线器运行。该节点仍然是版本2.35.0。 那么我也有同样的例外。我用2.29.0尝试了node和hub,但我的Firefox似乎太新了

我搜索了几个小时,但没有找到任何关于这个错误的信息

编辑: 该插件由Jenkins安装,自2013年8月18日起生效:

开发者在两天后于2013年8月20日更新了插件:


我不知道这是否导致了我的错误,但这是可能的。我还不知道如何做到这一点,但我将尝试从github上的源代码构建我自己的插件版本。

此错误意味着您没有连接到hub的节点。集线器正在运行并接收连接,但无法将请求转发到节点

确保已将节点连接到集线器。你可以这样做--


此命令可能不准确。查阅官方文件。

我现在清楚地知道问题是什么:

如上所述,该节点是Selenium版本2.35。当前的Jenkins Selenium插件是使用Selenium 2.29的版本2.3。这是导致错误的原因

现在我使用Selenium 2.29版作为节点。并安装了Firefox版本18。现在一切正常。我联系了开发人员,并试图从git构建当前的插件版本。现在还没有成功,但我想我会为此打开另一个线程


感谢您的帮助。

您可以在jenkins插件中更新selenium版本,在下面提到的路径中将2.29.0替换为2.39.0:

[Jenkins文件夹]\plugins\selenium\WEB-INF\lib

你会在这里找到那个旧罐子。用最新的jar替换它。
它可以正常工作。

节点是您的本地计算机吗?谢谢您的回答。我确实已将一个节点连接到集线器。命令:
java-jar-selenium-server-standalone-2.35.0.jar-role-node-hubhttp://localhost:4444/grid/register
查看Wiki:我可以在Jenkings Selenium插件中看到集线器。是的,现在它是我的本地计算机。一切都在本地运行。您如何连接节点?firefox需要访问X会话才能显示。好的,所有东西都在本地运行,所以在中心和节点的两侧都有一个X服务器。你能给我们看看你的测试类吗?也就是说,只要
WebDriver
被实例化,我就不确定我是否正确理解了你。WebDriver在代码被剪断之前被直接实例化。我调试了代码,在尝试创建新的RemoteWebDriver时引发异常。
java -jar selenium-server-2.29.0.jar -role node -hubUrl http://ip-of-hub:4444/wd/register