1

I am trying to launch chrome specific profile using python selenium

I try this code

option.add_argument("user-data-dir=C:\\Users\\Gamer\\AppData\\Local\\Google\\Chrome\\User Data\\Profile 2")

but it's open chrome as a Guest

2 Answers2

1

You can try with options like this :

from selenium import webdriver

options = webdriver.ChromeOptions()
options.add_argument("user-data-dir=C:\\Users\\Gamer\\AppData\\Local\\Google\\Chrome\\User Data\\Profile 2")
driver = webdriver.Chrome(executable_path=r'C:\path\to\chromedriver.exe', options=options)
driver.get("https://www.google.co.in")
cruisepandey
  • 28,520
  • 6
  • 20
  • 38
0

You can try it as below, For the profile location type chrome://version in the URL bar and check for Profile Path

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

options = webdriver.ChromeOptions()
options.add_argument(r"user-data-dir=C:\\Users\\Gamer\\AppData\\Local\\Google\\Chrome\\User Data")
options.add_argument(r'--profile-directory=Profile 2')
driver = webdriver.Chrome(executable_path=r'C:\path\to\chromedriver.exe', chrome_options=options)
driver.get("https://www.google.co.in")

Also, try to close the main browser instance while running it for multiple time else it might display the Exception

YaDav MaNish
  • 1,260
  • 2
  • 12
  • 20