How do I resolve this Selenium exception on a Mac thats says "chrome not reachable"?

223 Views Asked by At

I'm trying to learn how to automate web processes using Selenium and hopefully be able to build robust web scrapers and stuff. So, I just finished installing Pycharm and Selenium, and I am just trying to run a simple snippet of code that opens a web page in chrome, nothing too fancy. My code is as follows (it's in Python of course)

from selenium import webdriver


PATH = "/Users/Kudzie/Tools/chromedriver"
driver = webdriver.Chrome(PATH)
driver.get('https://orbitrevolution.tech')

So , when I run this code, I get this exception, and I have no idea how to solve this, I've tried reading past variations of this question but i didn't seem to get a solution that works. the exception is as follows

Traceback (most recent call last):
  File "/Users/Kudzie/PycharmProjects/Web Scraper/main.py", line 5, in <module>
    driver = webdriver.Chrome(PATH)
  File "/Users/Kudzie/PycharmProjects/Web Scraper/venv/lib/python3.9/site-packages/selenium/webdriver/chrome/webdriver.py", line 76, in __init__
    RemoteWebDriver.__init__(
  File "/Users/Kudzie/PycharmProjects/Web Scraper/venv/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/Users/Kudzie/PycharmProjects/Web Scraper/venv/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/Users/Kudzie/PycharmProjects/Web Scraper/venv/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/Users/Kudzie/PycharmProjects/Web Scraper/venv/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: chrome not reachable


Process finished with exit code 1

1

There are 1 best solutions below

3
On BEST ANSWER

Try replacing this:

driver = webdriver.Chrome(PATH)

With this:

driver = webdriver.Chrome(executable_path=PATH)