【发布时间】:2017-07-11 13:44:42
【问题描述】:
我目前正在尝试使用 Selenium Grid 与 Jenkins 和 Python 运行一些并行测试。
Jenkins 和 Selenium 插件工作正常。 Selenium Grid Hub 已启动,节点已成功注册。
编辑:我将 Jenkins 与 Selenium Plugin 一起使用,这意味着我自己不执行集线器和节点; jenkins 使用我指定的端口和驱动程序为我做这件事。无论如何,我从控制台中提取了这个
[Jenkins] $ "C:\Program Files (x86)\Jenkins\jre\bin\java" -cp "C:\Program Files (x86)\Jenkins\war\WEB-INF\lib\remoting-3.7.jar" hudson.remoting.Launcher -cp "C:\Program Files (x86)\Jenkins\plugins\selenium\WEB-INF\lib\selenium-server-standalone-3.1.0.jar;C:\Program Files (x86)\Jenkins\plugins\selenium\WEB-INF\lib\htmlunit-driver-standalone-2.20.jar" -connectTo localhost:49204
... More Selenium Grid Stuff...
INFORMATION: Will listen on 4444
Jul 13, 2017 7:42:40 AM org.openqa.grid.internal.Registry add
INFORMATION: Registered a node http://localhost:4445
我有一个在端口 4444 上运行的集线器和一个在端口 4445 上运行的节点。两者都在同一台机器上运行,并且端口已解锁。
Jenkins 在 Selenium Grid 选项卡中说以下内容:
Configuration
Host: localhost
Port: 4444
Status: Online
...
Selenium 2 clients should connect as follow:
WebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capability);
我的问题出在我的 python 代码中:
当我尝试使用中心 URL 和端口获取远程网络驱动程序时:
driver = webdriver.Remote(command_executor='http://localhost:4444/wd/hub', desired_capabilities=capabilities)
我收到以下错误:
response = {'status': 500, 'value': '{"status":13,"value":{"class":"java.lang.NullPointerException","stackTrace":[{"className":"j...adPool$3","methodName":"run","lineNumber":555},{"className":"java.lang.Thread","methodName":"run","lineNumber":-1}]}}'}
但是,当我像这样使用 Node 端口时:
driver = webdriver.Remote(command_executor='http://localhost:4445/wd/hub', desired_capabilities=capabilities)
然后一切正常工作。
也许我理解错了... Selenium Grid 不应该将远程 webdriver 与匹配条件的可用节点匹配吗?
可能是什么问题?我一直在疯狂搜索,但找不到任何相关内容
注意:我很确定desired_capabilities 配置正确。
谢谢!
【问题讨论】:
-
您能否考虑使用用于启动
Hub和Node的命令更新您的问题?谢谢
标签: python selenium jenkins jenkins-plugins