SergeyPirogov / webdriver_manager

Apache License 2.0
2.07k stars 461 forks source link

ChromeDriverManager().install() throws error when used with ChromeType.BRAVE in MacOS #642

Closed forti-davide closed 1 year ago

forti-davide commented 1 year ago

What called "ChromeDriverManager(chrome_type=ChromeType.BRAVE).install()" should install Brave's ChromeDriver, instead it generates an error. This thing doesn't happen on Chrome so it's BRAVE-only (I think)

Expected Behavior

Installing and/or opening the BRAVE Browser

Current Behavior

Traceback (most recent call last):
  File "/Users/<username>/PycharmProjects/<project_name>/main.py", line 6, in <module>
    driver = webdriver.Chrome(service=BraveService(ChromeDriverManager(chrome_type=ChromeType.BRAVE).install()))
                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/<username>/PycharmProjects/<project_name>/venv/lib/python3.11/site-packages/webdriver_manager/chrome.py", line 40, in install
    driver_path = self._get_driver_binary_path(self.driver)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/<username>/PycharmProjects/<project_name>/venv/lib/python3.11/site-packages/webdriver_manager/core/manager.py", line 35, in _get_driver_binary_path
    binary_path = self._cache_manager.find_driver(driver)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/<username>/PycharmProjects/<project_name>/venv/lib/python3.11/site-packages/webdriver_manager/core/driver_cache.py", line 105, in find_driver
    driver_version = self.get_cache_key_driver_version(driver)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/<username>/PycharmProjects/<project_name>/venv/lib/python3.11/site-packages/webdriver_manager/core/driver_cache.py", line 152, in get_cache_key_driver_version
    return driver.get_driver_version_to_download()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/<username>/PycharmProjects/<project_name>/venv/lib/python3.11/site-packages/webdriver_manager/core/driver.py", line 48, in get_driver_version_to_download
    return self.get_latest_release_version()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/<username>/PycharmProjects/<project_name>/venv/lib/python3.11/site-packages/webdriver_manager/drivers/chrome.py", line 61, in get_latest_release_version
    determined_browser_version = response_dict.get("builds").get(determined_browser_version).get("version")
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get'

Context (Environment)

from selenium import webdriver
from selenium.webdriver.chrome.service import Service as BraveService
from webdriver_manager.chrome import ChromeDriverManager
from webdriver_manager.core.os_manager import ChromeType

driver = webdriver.Chrome(service=BraveService(ChromeDriverManager(chrome_type=ChromeType.BRAVE).install()))
ndepaola commented 1 year ago

see #613 - it seems that brave is no longer supported. i had to switch from webdriver_manager to selenium's built-in manager to continue offering brave support in my project

forti-davide commented 1 year ago

Oh, i see. Thank you very much! But then it's not better to remove the Brave example from both the README.md and the pip page?