I am only starting to use Circle CI tool for running my Java autotests (Selenium, Maven).
My code in Java:
public void setUp() {
WebDriverManager.chromedriver().setup();
webDriver = new ChromeDriver(setOptions());
webDriver.manage().window().maximize();
webDriver.manage().timeouts().pageLoadTimeout(40, TimeUnit.SECONDS);
webDriver. manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
public ChromeOptions setOptions() {
ChromeOptions options = new ChromeOptions();
options.setHeadless(true);
options.addArguments("enable-automation");
options.addArguments("--headless");
options.addArguments("window-size=1024,768");
options.addArguments("--disable-extensions");
options.addArguments("--dns-prefetch-disable");
options.addArguments("--disable-gpu");
return options;
}
My config.yml in .circleci directory:
version: 2.1
jobs:
build:
docker:
- image: cimg/node:16.13.1-browsers
steps:
- checkout
- run: mkdir test-reports
- run:
name: Download Selenium
command: curl -O http://selenium-release.storage.googleapis.com/3.5/selenium-server-standalone-3.5.3.jar
- run:
name: Start Selenium
command: java -jar selenium-server-standalone-3.5.3.jar -log test-reports/selenium.log
background: true
test:
docker:
- image: cimg/openjdk:11.0
steps:
- checkout
- run:
name: build
command: mvn -B -DskipTests clean package
# Then run your tests!
- run:
name: test
command: mvn test -Dtest=SignUp
- store_test_results:
path: target/surefire-reports
workflows:
sample:
jobs:
- build
- test
Build job is finished successfully. But test job is failed with next error:
org.openqa.selenium.WebDriverException:
Timed out waiting for driver server to start.
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'df35181eab7e', ip: '172.31.0.3', os.name: 'Linux', os.arch: 'amd64', os.version: '5.13.0-1017-aws', java.version: '11.0.13'
Driver info: driver.version: ChromeDriver
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:24652/status] to be available after 20001 ms
Caused by: java.util.concurrent.TimeoutException
Could you, please, advise, how to fix this issue?
CodePudding user response:
This error message...
org.openqa.selenium.WebDriverException:
Timed out waiting for driver server to start.
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'df35181eab7e', ip: '172.31.0.3', os.name: 'Linux', os.arch: 'amd64', os.version: '5.13.0-1017-aws', java.version: '11.0.13'
Driver info: driver.version: ChromeDriver
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:24652/status] to be available after 20001 ms
Caused by: java.util.concurrent.TimeoutException
...implies that the driver server didn't get started.
You need to take care of a couple of things here:
The
config.yml
file in.circleci
directory mentions about Selenium v3.5.3:- run: name: Download Selenium command: curl -O http://selenium-release.storage.googleapis.com/3.5/selenium-server-standalone-3.5.3.jar
and
- run: name: Start Selenium command: java -jar selenium-server-standalone-3.5.3.jar -log test-reports/selenium.log
where as the error stacktrace mentions about Selenium v3.141.59:
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
You need to crosscheck the Selenium settings in Circle CI configuration and resolve the issue.