在通过 Jenkins 使用 Docker-compose 在网格上动态执行我的套件时,我得到以下异常堆栈跟踪:
org.openqa.selenium.remote.DesiredCapabilities firefox
INFO: Using `new FirefoxOptions()` is preferred to `DesiredCapabilities.firefox()`
org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: '49d4c6ec544d', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.25-linuxkit', java.version: '1.8.0_292'
Driver info: driver.version: RemoteWebDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:573)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:144)
at WebdriverBase.GridDriverManager.setDriver(GridDriverManager.java:144)
at WebdriverBase.GridDriverManager.getDriver(GridDriverManager.java:115)
at stepdefinition.PurchaseWorkflow.init(PurchaseWorkflow.java:32)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
我的中心网址:“http://selenium-hub:4444/wd/hub”
在本地系统上执行相同的代码时,Docker 容器上的一切正常。只有当我从 Jenkins 触发我的测试时才会出现问题。