1
votes

System environment:

  • JVM 11.0.6-open
  • ubuntu 18.04
  • SDKMAN 5.8.1+484
  • Gradle 6.1
  • Chrome Version 81.0.4044.138
  • Chrome driver 3.141.59

Code to run:

System.setProperty("webdriver.chrome.driver", "/snap/bin/chromium.chromedriver");
ChromeOptions options = new ChromeOptions();
options.addArguments("--headless");
WebDriver driver = new ChromeDriver(options);

4:52:09 PM: Executing task 'Runner.main()'...

Task :compileJava Task :processResources NO-SOURCE Task :classes

Task :Runner.main() error: unknown flag `port' May 14, 2020 4:52:30 PM org.openqa.selenium.os.OsProcess checkForError SEVERE: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1) Exception in thread "main" 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: '****', ip: '...', os.name: 'Linux', os.arch: 'amd64', os.version: '5.3.0-46-generic', java.version: '11.0.6' Driver info: driver.version: ChromeDriver at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:202) at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:188) at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:79) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:131) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:181) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:168) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:123) at Runner.main(Runner.java:19) Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:13284/status] to be available after 20004 ms at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:100) at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:197) ... 9 more Caused by: java.util.concurrent.TimeoutException at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:204) at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:156) at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:75) ... 10 more

Task :Runner.main() FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/6.1/userguide/command_line_interface.html#sec:command_line_warnings 2 actionable tasks: 2 executed

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':Runner.main()'.

    Process 'command '/home/***/.sdkman/candidates/java/current/bin/java'' finished with non-zero exit value 1

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 21s 4:52:30 PM: Task execution finished 'Runner.main()'.

1
Which version of chrome and chrome driver are you using? It sounds like a version mismatch. - Greg Burghardt
Also, which port is the selenium server attempting to use? Is there another process already using that port? - Greg Burghardt
@GregBurghardt probably, that is not my case. I managed to fix it. Removing this line of code makes it work. System.setProperty("webdriver.chrome.driver", "/snap/bin/chromium.chromedriver"); I do not really understand how driver is consumed by my system - Alex_Gofman
@GregBurghardt One more thing, in my case server even could not be started. On the other hand, it is perfectly fine if I run it manually - Alex_Gofman
Chrome Version 81.0.4044.138, Chrome driver 3.141.59 - Alex_Gofman

1 Answers

0
votes

You need to upgrade your ChromeDriver to match the major version of your Chrome browser:

https://sites.google.com/a/chromium.org/chromedriver/

You will probably want version 81.0.4044.138.