有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java无法在Selenium 3.0网格/节点上创建WebDriver实例

试图使用Selenium 3.0在本地运行一些Selenium测试,但出现以下错误:

org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{marionette=true, screen-resolution=1680x1050, commandTimeout=300, record-video=true, version=50.1.0, platform=MAC, tags=[Ljava.lang.String;@1ac4da8f, build=jgilmore-12291406, idleTimeout=120, name=homePageSmokeTest, browserName=firefox, seleniumVersion=null, maxDuration=360}], required capabilities = Capabilities [{}]
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:49:13 -0700

目前正在运行Selenium Hub,如下所示:

java -jar /Users/jgilmore/Selenium/selenium-server-standalone-3.0.1.jar -role hub -timeout 15

以及节点(尝试先用Geckodriver运行Firefox 50.1.0):

java -Dwebdriver.gecko.driver=/Users/jgilmore/Selenium/geckodriver -jar selenium-server-standalone-3.0.1.jar -port 5557 -role node -hub http://localhost:4444/grid/register -browser "browserName=firefox, browserVersion=50.1.0, maxInstances=10"

网格和节点启动很好(请在网格控制台中查看),但在尝试运行测试时,我无法创建WebDriver实例。这对我使用Selenium 2很有效。x、 所以我想我错过了什么。感谢您的帮助


共 (1) 个答案

  1. # 1 楼答案

    在gasalis的帮助下,我想我们解决了我的问题:

    1. 将节点和本地配置上的browserVersion更改为version
    2. 无论出于何种原因,我必须将Firefox和Chrome的浏览器版本设置为ANY。我无法明确说明浏览器版本,例如Firefox的“50.1.0”或Chrome的“55”。也许我遗漏了什么,但这是另一个问题的问题

    通过更改这两件事,我现在可以成功创建运行本地Selenium脚本所需的WebDriver

    谢谢你的帮助gsaslis