1

I have the following code

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

options = Options()
options.add_argument("start-maximized")
options.add_argument("enable-automation")
options.add_argument("--no-sandbox")
options.add_argument("--disable-dev-shm-usage")
options.add_argument("--disable-infobars")
options.add_argument("--disable-gpu")
options.add_argument("--disable-browser-side-navigation")
driver = webdriver.Chrome(options=options)

which returns the error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
    desired_capabilities=desired_capabilities)
  File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

If I run with options.add_arguments("--headless"), I don't receive any error. Unfortunately, I can't really run what I'd like to in headless. Does anybody have any ideas?

0

1 Answer 1

1

ChromeDriver isn't finding the port it needs to talk to Chrome over.

Solution : Check your chrome browser version and then you can download chromedriver from the below location.

https://chromedriver.chromium.org/downloads

Useful link : https://sites.google.com/a/chromium.org/chromedriver/downloads/version-selection

Sign up to request clarification or add additional context in comments.

4 Comments

In usr/bin I see that the Google Chrome version is Google Chrome 78.0.3904.108 and the Chrome Driver is ChromeDriver 78.0.3904.108, though
Are you running your test in headless mode. if not then add options.add_argument('--headless')
No, I'm specifically trying to use Chrome out of headless mode. Could it have to do with the display?
@pete were you able to find a solution? I am in the same boat, trying to run Chrome in non-headless mode while using xvfb and getting the same error

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.