Selenium.webdriver.brave doesn't exist in python. Would you please make it?

819 views Asked by At

Selenium4 Brave Webdriver_manager python

My Issue: I want to use Selenium 4 on brave using webdriver_manager written in python.

I went to https://pypi.org/project/webdriver-manager/ and installed webdriver-manager and used their code example to run brave using webdriver-manager:

# selenium 4
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager

driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))

This is the output I get when I run it just like this:

>>> %Run webdrivermanagerbrave.py


====== WebDriver manager ======
Current brave-browser version is 100
Get LATEST chromedriver version for 100 brave-browser
Trying to download new driver from https://chromedriver.storage.googleapis.com/100.0.4896.60/chromedriver_win32.zip
Driver has been saved in cache [C:\Users\IanMF\.wdm\drivers\chromedriver\win32\100.0.4896.60]
Traceback (most recent call last):
  File "C:\Users\IanMF\AppData\Local\Programs\Python\Python310\webdrivermanagerbrave.py", line 6, in <module>
    driver = webdriver.Chrome(service=Service(ChromeDriverManager(chrome_type=ChromeType.BRAVE).install()))
  File "C:\Users\IanMF\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 69, in __init__
    super(WebDriver, self).__init__(DesiredCapabilities.CHROME['browserName'], "goog",
  File "C:\Users\IanMF\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 93, in __init__
    RemoteWebDriver.__init__(
  File "C:\Users\IanMF\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 266, in __init__
    self.start_session(capabilities, browser_profile)
  File "C:\Users\IanMF\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 357, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "C:\Users\IanMF\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 418, in execute
    self.error_handler.check_response(response)
  File "C:\Users\IanMF\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 243, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary
Stacktrace:
Backtrace:
    Ordinal0 [0x00BF7413+2389011]
    Ordinal0 [0x00B89F61+1941345]
    Ordinal0 [0x00A7C658+837208]
    Ordinal0 [0x00A9770E+947982]
    Ordinal0 [0x00A95C51+941137]
    Ordinal0 [0x00AC8C80+1150080]
    Ordinal0 [0x00AC88DA+1149146]
    Ordinal0 [0x00AC3F66+1130342]
    Ordinal0 [0x00A9E546+976198]
    Ordinal0 [0x00A9F456+980054]
    GetHandleVerifier [0x00DA9632+1727522]
    GetHandleVerifier [0x00E5BA4D+2457661]
    GetHandleVerifier [0x00C8EB81+569713]
    GetHandleVerifier [0x00C8DD76+566118]
    Ordinal0 [0x00B90B2B+1968939]
    Ordinal0 [0x00B95988+1989000]
    Ordinal0 [0x00B95A75+1989237]
    Ordinal0 [0x00B9ECB1+2026673]
    BaseThreadInitThunk [0x77146739+25]
    RtlGetFullPathName_UEx [0x77B98E7F+1215]
    RtlGetFullPathName_UEx [0x77B98E4D+1165]

>>> 

the important part of this I think is:

selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find 
Chrome binary

So I think it can't find brave. many solutions to this suggest using deprecated executable_path. I'm not ok with using deprecated code. However there isn't a Brave Extension on the selenium.webdriver.brave So I can't use the suggested passing in a service option that the code wants me to do. I want a native way to use Brave instead of typing

from selenium.webdriver.chrome.service import Service

This is definitely due to my aversion to Chrome. I want nothing to do with it. Is there anyone out there who can make my wish come true?

1

There are 1 answers

3
Devam Sanghvi On

There is an way to solve your problem using chromedriver_autoinstaller module

You can Install using pip install chromedriver-autoinstaller

Example:

from selenium import webdriver
import chromedriver_autoinstaller

chromedriver_autoinstaller.install()
driver = webdriver.Chrome()

For more reference go to this Link