WebDriverError error: Chrome failed to start: exited abnormally

Shir Avr picture Shir Avr · Jun 16, 2017 · Viewed 8.5k times · Source

I'm trying to run protractor test on ubuntu 14.04 vm (by google cloud), for some reason when i run 'protractor conf.js' i get an error says:

E/launcher - WebDriverError: unknown error: Chrome failed to start: exited abnormally

I followed this tasks in order to install headless chrome: https://gist.github.com/alonisser/11192482

  • Before running protractor cons.js, i'm running "webdriver-manager start"

  • When i run 'Xvfb -ac :2 -screen 0 1280x1024x16' its freeze when gets to 'Initializing built-in extension GLX'

  • I also tried change the conf.js to chromeOptions: { args: [ "--headless", "--disable-gpu", "--window-size=800x600" ]' but and protractor print 'start' then error: 'Failed: unknown error: an X display is required for keycode conversions, consider using Xvfb'

  • It's important to mention that it's all worked great, before a couple hours. then i just let my mac sleep, and of course it was exit the vm..

  • I'm running the same tests with protractor in my mac and its works great. the problem is related to chrome/chromeDriver on the instance vm.

thanks a lot!!!

Answer

Raony Benjamim picture Raony Benjamim · Nov 3, 2017

I had a similar problem when using selenium + python 2.7 + chromedriver in a AWS EC2 machine.

In my case I was using the newest headless feature, so adding 'no-sandbox' parameter to the ChromeOptions object did the trick.

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('headless')
chrome_options.add_argument('no-sandbox')
driver = webdriver.Chrome(chrome_options=chrome_options)

The problem seems to be a permission issue with chrome. It does not allow a 'root' user to execute it without the --no-sandbox flag