SeleniumHQ / selenium

A browser automation framework and ecosystem.
https://selenium.dev
Apache License 2.0
29.76k stars 8.02k forks source link

Message: 'chromedriver' executable needs to be in PATH [🐛 Bug]: #14080

Closed Carmaiquel closed 4 weeks ago

Carmaiquel commented 4 weeks ago

What happened?

I installed Selenium 4.6.0 trusting that with Selenium Manager the drivers issue will be gone. But there is still an issue. The error show that WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://chromedriver.chromium.org/home

How can we reproduce the issue?

pip install selenium==4.6.0

from selenium import webdriver
driver=webdriver.Chrome()
driver.get('https://www.carrefour.com.ar/almacen')

Relevant log output

---------------------------------------------------------------------------
WebDriverException                        Traceback (most recent call last)
File ~/.pyenv/versions/taxifare-env/lib/python3.10/site-packages/selenium/webdriver/common/service.py:97, in Service.start(self)
     96 try:
---> 97     path = SeleniumManager.driver_location(browser)
     98 except WebDriverException as new_err:

File ~/.pyenv/versions/taxifare-env/lib/python3.10/site-packages/selenium/webdriver/common/selenium_manager.py:68, in SeleniumManager.driver_location(browser)
     67 args = (str(SeleniumManager.get_binary()), "--browser", browser)
---> 68 result = SeleniumManager.run(args)
     69 command = result.split("\t")[-1].strip()

File ~/.pyenv/versions/taxifare-env/lib/python3.10/site-packages/selenium/webdriver/common/selenium_manager.py:85, in SeleniumManager.run(args)
     84 if not re.match("^INFO\t", result):
---> 85     raise WebDriverException(f"Unsuccessful command executed: {args}")
     87 return result

WebDriverException: Message: Unsuccessful command executed: ('/home/scaride/.pyenv/versions/taxifare-env/lib/python3.10/site-packages/selenium/webdriver/common/linux/selenium-manager', '--browser', 'chrome')

During handling of the above exception, another exception occurred:

WebDriverException                        Traceback (most recent call last)
Cell In [2], line 2
      1 from selenium import webdriver
----> 2 driver=webdriver.Chrome()
      3 driver.get('https://www.carrefour.com.ar/almacen')

File ~/.pyenv/versions/taxifare-env/lib/python3.10/site-packages/selenium/webdriver/chrome/webdriver.py:81, in WebDriver.__init__(self, executable_path, port, options, service_args, desired_capabilities, service_log_path, chrome_options, service, keep_alive)
     78 if not service:
     79     service = Service(executable_path, port, service_args, service_log_path)
---> 81 super().__init__(
     82     DesiredCapabilities.CHROME["browserName"],
     83     "goog",
     84     port,
     85     options,
     86     service_args,
     87     desired_capabilities,
     88     service_log_path,
     89     service,
     90     keep_alive,
     91 )

File ~/.pyenv/versions/taxifare-env/lib/python3.10/site-packages/selenium/webdriver/chromium/webdriver.py:103, in ChromiumDriver.__init__(self, browser_name, vendor_prefix, port, options, service_args, desired_capabilities, service_log_path, service, keep_alive)
    100     raise AttributeError("service cannot be None")
    102 self.service = service
--> 103 self.service.start()
    105 try:
    106     super().__init__(
    107         command_executor=ChromiumRemoteConnection(
    108             remote_server_addr=self.service.service_url,
   (...)
    114         options=options,
    115     )

File ~/.pyenv/versions/taxifare-env/lib/python3.10/site-packages/selenium/webdriver/common/service.py:100, in Service.start(self)
     98         except WebDriverException as new_err:
     99             logger.debug("Unable to obtain driver using Selenium Manager: " + new_err.msg)
--> 100             raise err
    102         self._start_process(path)
    104 count = 0

File ~/.pyenv/versions/taxifare-env/lib/python3.10/site-packages/selenium/webdriver/common/service.py:91, in Service.start(self)
     83 """
     84 Starts the Service.
     85 
   (...)
     88    or when it can't connect to the service
     89 """
     90 try:
---> 91     self._start_process(self.path)
     92 except WebDriverException as err:
     93     if "executable needs to be in PATH" in err.msg:

File ~/.pyenv/versions/taxifare-env/lib/python3.10/site-packages/selenium/webdriver/common/service.py:203, in Service._start_process(self, path)
    201 except OSError as err:
    202     if err.errno == errno.ENOENT:
--> 203         raise WebDriverException(
    204             f"'{os.path.basename(self.path)}' executable needs to be in PATH. {self.start_error_message}"
    205         )
    206     elif err.errno == errno.EACCES:
    207         raise WebDriverException(
    208             f"'{os.path.basename(self.path)}' executable may have wrong permissions. {self.start_error_message}"
    209         )

WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://chromedriver.chromium.org/home

Operating System

Ubuntu

Selenium version

Python

What are the browser(s) and version(s) where you see this issue?

Chrome

What are the browser driver(s) and version(s) where you see this issue?

Version 125.0.6422.113 (Official Build) (64-bit)

Are you using Selenium Grid?

3.6.0

github-actions[bot] commented 4 weeks ago

@Carmaiquel, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

titusfortner commented 4 weeks ago

Chrome changed where downloads come from and many improvements have been made since 4.6

Regardless, we can only fix the most recent version, so please update to 4.21.

Carmaiquel commented 3 weeks ago

I updated the version but the problem continues with a new kind of error.

SessionNotCreatedException: Message: session not created: Chrome failed to start: exited normally.
  (session not created: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /home/scaride/.cache/selenium/chrome/linux64/125.0.6422.141/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
titusfortner commented 3 weeks ago

See https://github.com/SeleniumHQ/selenium/issues/12841