WebDriverError error: Chrome failed to start: exited abnormally

天涯浪子 提交于 2019-12-04 11:57:04

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

Turned out, the answer is in my question.

You should run the command Xvfb -ac :99 -screen 0 1280x1024x16

and right after export DISPLAY=:99

I also add to my start.sh script the command export DISPLAY=:99 The order seems to be important. You can ignore the error of the GLX when running the Xvfb, it can work without it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!