I am trying open Brave browser, but every time this happen, browser open without any extensions, which I have if I open browser normally. Why this happen and what can I do to open this with extensions I need?
I tried open this, so there is code
from selenium import webdriver
driver_path = "C:/Users/User1/chromedriver.exe"
brave_path = "C:/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe"
option = webdriver.ChromeOptions()
option.binary_location = brave_path
browser = webdriver.Chrome(executable_path=driver_path, chrome_options=option)
browser.get("https://www.google.com")
Thanks for any help.
You have to download the extension as a crx-file, then declare it in your chromeoptions.
from selenium import webdriver
add_block_ext = "Path to .crx extension"
driver_path = "C:/Users/User1/chromedriver.exe"
brave_path = "C:/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe"
option = webdriver.ChromeOptions()
option.binary_location = brave_path
option.add_extension(add_block_ext)
browser = webdriver.Chrome(executable_path=driver_path, chrome_options=option)
browser.get("https://www.google.com")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.