[Solved] unknown error: Chrome failed to start: exited abnormally (Driver info: chromedriver=2.36.540471

I wrote a crawler in python, it works fine in pycharm, but it reports an error on the command line under linux
Message: unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.36.540471 (9c759b81a907e70363c6312294d30b6ccccc2752),platform=Linux 4.14.0-deepin2-amd64 x86_64)
You are using arg –headless so with that my be you can try with another argument –no-sandbox and window-size=1024,768.

chrome.additional.capabilities={“chromeOptions”:{“args”:[“–headless”, “window-size=1024,768”, “–no-sandbox”], “binary”: “/home/ubuntu/software/chromedriver”}}

Solution:

chrome_options = Options()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--disable-gpu')
chrome_options.add_argument("window-size=1024,768")
chrome_options.add_argument("--no-sandbox")
driver = webdriver.Chrome(chrome_options=chrome_options)

Read More: