Selenium Webdriver Service object

I 'm lookin for a tutorial on how to write a python script using Selenium v4.0.0 and Brave browser (Chromium v95.0.4638.69).
I want to use the most updated code using a service object. Below is the code for chrome. How do I do the same thing for Brave?

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

# Declare variables and setup services
driverService = Service('C:/webdrivers/chromedriver.exe')   
# 1. Passes the chromedriver path to the service object
# 2. stores the service object in the s variable
driver = webdriver.Chrome(service=driverService)            
# 1. Passes service object s into the webdriver.Chrome  
# 2. Stores object in driver variable 

# Body (actually doing stuff)
driver.maximize_window()                # maximizes the browser window
driver.get("https://www.google.com")    # navigates to google.com
myPageTitle = driver.title              
# gets the title of the web page stores in myPageTitle
print(myPageTitle)                      # prints myPageTitle to Console
assert "Google" in myPageTitle          
# checks myPageTitle to ensure it contains Google

# clean up
driver.quit()                           # closes the browser
1 Like

+1

Please help. I have the same question and no other forum has helped.

from selenium import webdriver

from selenium.webdriver.chrome.service import Service

chromedriver = "C:/webdrivers/chromedriver.exe"

option = webdriver.ChromeOptions()

option.binary_location = "C:/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe"

s = Service(chromedriver)

driver = webdriver.Chrome(service=s, options=option)

driver.get("https://google.com")

I have found this bit of code to work. I am still trying to figure out how to do the same thing with Webdriver_manager. The author sergeyPirogov posted this on pypi.org at https://pypi.org/project/webdriver-manager/

I emailed his company’s email but haven’t gotten a response because it’s been less than 24 hours since I sent it as of now.

hopefully I will get an answer for this.