Selenium code works my local. However it doesn't work over jenkins because of server connection error regarding to jenkins console output.
Jenkins has openshift structure and chrome slave. I've set the configuration that selenium would work on chrome node.
I've also written the selenium codes as bdd (cucumber).
This is how webDriver is initialized:
ChromeOptions options = new ChromeOptions();
System.setProperty("webdriver.chrome.driver","/usr/bin/google-chrome");
options.addArguments("--disable-web-security");
options.addArguments("--ignore-urlfetcher-cert-requests");
options.addArguments("--disable-renderer-backgrounding");
options.addArguments("--disable-infobars");
options.addArguments("--start-maximized");
options.addArguments("--no-sandbox");
if (isHeadless) {
options.addArguments("--headless");
}
webDriver = new ChromeDriver(options);
The jenkins output is:
2019-02-12 16:14:54 [main] INFO TestingConfig:65 - Loading TestingConfig
(google-chrome:7834): Gtk-WARNING **: 16:14:57.172: cannot open display: Feb 12, 2019 4:15:15 PM org.openqa.selenium.os.UnixProcess checkForError SEVERE: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
Scenario: add new scenario # features/AddNewScenario.feature:11 Given I've already display New Scenario Page # AddingNewScenarioTest.iVeAlreadyDisplayScenarioPage() org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start. Build info: version: '3.5.2', revision: '10229a9', time: '2017-08-21T17:29:55.15Z' System info: host: 'jenkins-agent-blue-1', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-957.1.3.el7.x86_64', java.version: '1.8.0_161' Driver info: driver.version: ChromeDriver at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:192) at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:178) at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:78) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:641) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:254) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:236) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:137) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:178) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:167) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:156) at com.bmw.scmaer.testing.utils.WebBrowser.init(WebBrowser.java:50) at com.bmw.scmaer.testing.steps.AddingNewScenarioTest.iVeAlreadyDisplayScenarioPage(AddingNewScenarioTest.java:22) at ✽.Given I've already display Scenario Page(features/AddNewScenario.feature:12) Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:3437/status] to be available after 20004 ms at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:102) at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:187) at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:178) at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:78) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:641) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:254) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:236) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:137) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:178) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:167) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:156) at com.bmw.scmaer.testing.utils.WebBrowser.init(WebBrowser.java:50)
Additional question: Why did it try to connect to http://localhost:3437/status ?