Home >Backend Development >Python Tutorial >Why Does Selenium WebDriver Throw 'unable to obtain {service.path} using Selenium Manager'?

Why Does Selenium WebDriver Throw 'unable to obtain {service.path} using Selenium Manager'?

Mary-Kate Olsen
Mary-Kate OlsenOriginal
2024-12-28 09:52:10564browse

Why Does Selenium WebDriver Throw

Unable to Use Selenium WebDriver: Two Exceptions Encountered

When attempting to instantiate a Selenium WebDriver object, some developers may encounter the following error:

"unable to obtain {service.path} using Selenium Manager; 'str' object has no attribute 'capabilities'"

This error can be traced back to issues with Selenium Manager in conjunction with newer versions of Selenium (v4.6.0 and above). The root cause lies in attempting to set the driver.exe path manually.

Solution:

In newer versions of Selenium, the WebDriver manager capability has been enhanced, eliminating the need for manual driver path specification. To resolve the issue, simplify your code by removing the driver.exe path:

from selenium import webdriver

driver = webdriver.Chrome()  # Automatically handles browser and driver
driver.get("https://www.google.com/")
driver.quit()

References:

  • [Purpose of WebDriver Manager](https://www.selenium.dev/documentation/webdriver/webdriver_manager/)
  • [Introducing Selenium Manager](https://tombevans.org/introduction-to-the-new-selenium-manager-on-selenium-4-5/)

The above is the detailed content of Why Does Selenium WebDriver Throw 'unable to obtain {service.path} using Selenium Manager'?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn