【发布时间】:2018-11-26 14:10:25
【问题描述】:
我们有一个自动化脚本,它在 jenkins 和 docker 的网格中运行。 因此,当我们尝试运行 selenium 代码时,它会连接到网格节点 chrome 或 ff,然后在 selenium java 代码的基础上执行。
这一切都发生在安装了 docker 的 linux 服务器上,我们有四个容器——Jenkins、Selenium 网格、chrome 节点和 ff 节点。
但是当我尝试从 jekins 运行作业时,它会失败并给出以下错误-
runners.TestRunner > Scenario: Extract the Report.classMethod FAILED
org.openqa.selenium.remote.UnreachableBrowserException
Caused by: java.net.NoRouteToHostException
org.openqa.selenium.remote.UnreachableBrowserException
Caused by: java.net.NoRouteToHostException
org.openqa.selenium.remote.UnreachableBrowserException
Caused by: java.net.NoRouteToHostException
现在,当我不从 docker 设置运行它并从 IntelliJ 执行它时,同样可以正常工作。
private WebDriver createSTAGEDriver() throws MalformedURLException {
switch (driverType) {
case GridChrome :
DesiredCapabilities cap = DesiredCapabilities.chrome();
cap.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR, UnexpectedAlertBehaviour.IGNORE);
driver = new RemoteWebDriver(new URL("http://xx.xx.xxx.xxxx:xxxxx/wd/hub"),cap);
break;
无法找出问题所在。
任何帮助将不胜感激。
【问题讨论】:
标签: docker jenkins selenium-chromedriver selenium-grid