0

I'm unable to get chromium to run when i put my code in theoretically it looks like it should work i even followed tutorials but i keep getting the same error message. This is the code that i put:

from selenium import webdriver

#chromedriver varible with exact location to where its saved
chromedriver = "/home/jackmiller/Downloads/chromedriver"

#varible of drive to run open up the chrome driver which is located
#on my machine as chromedriver varible chromedriver
driver = webdriver.Chrome(chromedriver)

#open this website
driver.get('https://youtube.com')

and when i run the code in terminal this is what it returns:

Traceback (most recent call last):
  File "automation.py", line 8, in <module>
    driver = webdriver.Chrome(chromedriver)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
    desired_capabilities=desired_capabilities)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python2.7/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/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

It's not opening chromium at all

  • Are you using google-chrome or chromium? In text you talk about chromium, but the error says `The process started from chrome location /usr/bin/google-chrome` ... – M. Volf Mar 25 '20 at 16:11
  • im using chromium but i just switched to firefox instead and it partially worked i got the browser to open youtube – Good Vibes Coder Mar 25 '20 at 16:27

2 Answers2

0

Have you tried: options.add_argument("--remote-debugging-port=9222")

From this bug report: https://github.com/SeleniumHQ/selenium/issues/6049

A workaround is to specify the remote debugging port as an argument for your ChromeOptions, something like: options.add_argument("--remote-debugging-port=9222"), and if you're running in a container make the driver headless like so options.headless = True, otherwise use something like pyvirtualdisplay for screenshots.

DMart
  • 2,401
  • 1
  • 14
  • 19
0

Are you tried make chromedriverfile executable? sudo chmod a+x chromedriver

pawelkuznik
  • 107
  • 10