3

I can't get Chromedriver to run in a Docker, and it seems I'm passing everything as needed, but it still throws the 'root with sandbox' error and quits.

2019-02-15 15:30:22 INFO : Using chromedriver set in webdriver.chrome.driver: /usr/bin/google-chrome
2019-02-15 15:30:22 INFO : Setting ChromeDriver options {browserName=chrome, goog:chromeOptions={args=[--start-maximized, headless, --no-sandbox], extensions=[], prefs={profile.default_content_settings.popups=0, download.prompt_for_download=false, download.default_directory=/home/jenkins/workspace/..../}}}
[1036:1036:0215/153022.769651:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
Feb 15, 2019 3:30:42 PM org.openqa.selenium.os.OsProcess checkForError
SEVERE: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
Failure in before hook:Hooks.getDriver(Scenario)

I've logged the ChromeOptions content and it's clear args contains --no-sandbox - What could be the problem here?


  • Google Chrome 70.0.3538.77
  • org.seleniumhq.selenium:selenium-chrome-driver:jar: 3.141.59

Similar to How to run selenium chromedriver as root? (not working even with --no-sandbox but that was solved by a Python dependency - this is a Java project.


I've also added -Dwebdriver.chrome.args="--no-sandbox" to the Maven command.

antonyh
  • 2,131
  • 2
  • 21
  • 42
  • 1
    Which version of ChromeDriver are you using? It should be ChromeDriver 2.45 for Chrome v70 – Jens Dibbern Feb 15 '19 at 16:45
  • I'll see if I can find out, but I thought the 2.xx was a Python thing? It's Chrome 70 installed, isn't that the only dependency outside Java? If that's the case, I'm pointing the chromedriver at chrome itself which is probably wrong. – antonyh Feb 15 '19 at 17:11
  • Turns out I'm using Chromedriver 2.43. I'll try updating to 2.45. – antonyh Feb 15 '19 at 17:17
  • Thank you @JensDibbern - this was the root of the problem, and forcing the right version fixes this. Could you post an answer and I'll accept it? If you have a link to a page listingwhich Chrome needs which ChromeDriver add that too, it'd be super-useful to have that info. – antonyh Feb 15 '19 at 17:41
  • 1
    under what circumstance would you want to run as root? – Corey Goldberg Feb 16 '19 at 23:44
  • Good question - It runs as root in the docker container that's used as a Jenkins slave. It's not uncommon to do this despite the potential security concerns. – antonyh Feb 18 '19 at 00:07

1 Answers1

4

You have to use matching Chrome and ChromeDriver versions for Selenium to work properly. There is a list at http://chromedriver.chromium.org/downloads.

At the time of this post:

  • If you are using Chrome version 73, please download ChromeDriver 73.0.3683.20
  • If you are using Chrome version 72, please download ChromeDriver 2.46 or ChromeDriver 72.0.3626.69
  • If you are using Chrome version 71, please download ChromeDriver 2.46 or ChromeDriver 71.0.3578.137
Jens Dibbern
  • 1,434
  • 2
  • 13
  • 20
  • Thanks! It looks like the version numbers aligned for v73 then? I hope so, this will make it much easier. – antonyh Feb 15 '19 at 18:07