2

I'm a beginner level python programmer,

I am currently working on a browser automater using selenium, but currently i'am using brave version 96.0.4664.45 and my chrome driver is'nt working properly, whereas geckodriver is working fine with firfox

error here---> Errors with selenium library in python path and all correct with my side

Pls help me as soon as possible

  • pls anyone help with this problem i am stuck with this issue for more than a month – user17732218 Dec 24 '21 at 11:08
  • Does this answer your question? [FileNotFoundError: \[WinError 2\] The system cannot find the file specified error with selenium library in Python](https://stackoverflow.com/questions/70462971/filenotfounderror-winerror-2-the-system-cannot-find-the-file-specified-error) – bordeaux Dec 26 '21 at 15:36

2 Answers2

0

I suggest to try webdriver_manager

https://github.com/SergeyPirogov/webdriver_manager.

It helps to setup path to chromedriver.

For Chrome:

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager

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

For Chromium:

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from webdriver_manager.utils import ChromeType

driver = webdriver.Chrome(ChromeDriverManager(chrome_type=ChromeType.CHROMIUM).install())

I suppose some of this will work for Brave.

Also, take a look at this example:

https://gist.github.com/passivebot/91d726bafc1f08eb475dd8384a3f21db

Max Daroshchanka
  • 2,698
  • 2
  • 10
  • 14
0

To initiate a browsing context you need to:

  • Use the binary_location attribute to point to the brave binary location.
  • Use the chromedriver executable to initiate the brave browser.

Code block:

from selenium import webdriver
from selenium.webdriver.chrome.service import Service

option = webdriver.ChromeOptions()
option.binary_location = r'C:\Program Files (x86)\BraveSoftware\Brave-Browser\Application\brave.exe'
driverService = Service('C:/Users/.../chromedriver.exe')
driver = webdriver.Chrome(service=driverService, options=option)
driver.get("https://www.google.com")

References

You can find a couple of relevant detailed discussions in:

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352