mardi 24 août 2021

Can't seem to get Selenium to use my default profile

Really straightforward question. Did a bunch of research but none of the solutions seem to work for me. I just want to have all my bookmarks etc. when running my selenium script.

from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
import time
import datetime
from selenium import webdriver

options = Options()
    options.add_experimental_option("detach", True)
    options.add_argument("--window-size=1920,1080")
    options.add_argument('--disable-gpu')  # For properly seeing the outputs
    options.add_argument("--disable-notifications")
    options.binary_location = '/Applications/Brave Browser.app/Contents/MacOS/Brave Browser'
    options.add_argument(r"--user-data-dir=/Users/vadim/Library/Application Support/BraveSoftware/Brave-Browser/Default")
    options.add_argument(r'--profile-directory=/Users/vadim/Library/Application Support/BraveSoftware/Brave-Browser/Default/Default')
    driver_path = '/Users/vadim/Desktop/Coding/chromedriver'
    driver = webdriver.Chrome(options=options, executable_path=driver_path)
    driver.get('http://www.google.com')

I'm using brave browser btw.

Thanks in advance!




Aucun commentaire:

Enregistrer un commentaire