0

I am trying to open chrome with selenium using my account and i looked online how to do this but i got some werid error when i run my code

this is the code:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

options = webdriver.ChromeOptions()
options.add_argument( "user-data-dir =C:\\Users\\shaked\\AppData\\Local\\Google\\Chrome\\User Data\\Profile 1")

cdriver = "D:\\chromedriver"
driver = webdriver.Chrome(executable_path=cdriver, chrome_options=options)
driver.get("https://www.google.com")

and whem i run the code it lucnch chrome and opening this page for a sec and load google without loading my profile

there is a way to fix this?

shaked maman
  • 111
  • 1
  • 2
  • 6

1 Answers1

0

Below code is working fine for me. I just tried that out. Could you please use the same and just update the path of chromedriver and profile

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

options = webdriver.ChromeOptions()
options.add_argument( "user-data-dir=C:\\Users\\Sangeeta-Laptop\\AppData\\Local\\Google\\Chrome\\User Data\\Guest Profile");
cdriver = "C:\\Users\\Sangeeta-Laptop\\Downloads\\chromedriver_win32 (4)\\chromedriver"
driver = webdriver.Chrome(executable_path=cdriver, chrome_options=options)
driver.get("https://www.google.com")
UnknownBeast
  • 979
  • 1
  • 6
  • 13