0

Im trying to run selenium on Brave Browser instead of Google Chrome. As the docs indicate in (https://pypi.org/project/webdriver-manager/#use-with-edge), I should input this exactly and Brave Browser will run, except it wont at all, it will run only Google Chrome

This is the code im using:

from selenium import webdriver
from selenium.webdriver.chrome.service import Service as BraveService
from webdriver_manager.chrome import ChromeDriverManager
from webdriver_manager.core.utils import ChromeType
import time, urllib3.request

driver = webdriver.Chrome(service=BraveService(ChromeDriverManager(chrome_type=ChromeType.BRAVE).install()))
driver.get("https://www.google.com/")
time.sleep(5)

It will only run Google Chrome instead of Brave Browser, anyone could please try and help me out to run on Brave Browser using webdriver_manager? Thanks

Yann02
  • 1
  • Did you pay attention to the version? Which version of selenium are you using? – MSH Jan 16 '23 at 18:07
  • Well I installed selenium using pip3 this day exactly, which means its up to date, as per Brave Browser I also updated it today. Which means both are at the same version supposedly, im not sure how can I check tho. – Yann02 Jan 16 '23 at 18:10
  • Check the version of the selenium. See: https://stackoverflow.com/a/20428836/2681662 Then use he correct approach according to your version. – MSH Jan 17 '23 at 09:45

1 Answers1

0

If you have Brave Browser installed on your computer, you can set the binary location of the webdriver.ChromeOptions to the location of brave.exe on your computer. In my case, the brave browser program is located here:

"C:\\Program Files (x86)\\BraveSoftware\\Brave-Browser\\Application\\brave.exe"

Here is an example of how to do this:

Code:

# selenium 4
from selenium import webdriver
from selenium.webdriver.chrome.service import Service as BraveService
from webdriver_manager.chrome import ChromeDriverManager
from webdriver_manager.core.utils import ChromeType

option = webdriver.ChromeOptions()
option.binary_location = "C:\\Program Files (x86)\\BraveSoftware\\Brave-Browser\\Application\\brave.exe"

driver = webdriver.Chrome(service=BraveService(ChromeDriverManager(chrome_type=ChromeType.BRAVE).install()), options=option)
driver.get("https://www.google.com")
ScottC
  • 3,941
  • 1
  • 6
  • 20