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
CodePudding user response:
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
CodePudding user response:
To initiate a brave 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: