Issue
Here's my code:
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument(r"user-data-dir=C:\Users\shahr\AppData\Local\Google\Chrome\User Data\Profile 1") #Path to your chrome profile
w = webdriver.Chrome(executable_path=r"C:\Program Files (x86)\chromedriver.exe", options=options)
I tried this from other StackOverFlow Answers, but it refuses to open the desired profile
Solution
chrom_options.add_argument("user-data-dir=C:\\Users\robert.car\\AppData\\Local\\Google\\Chrome\\User Data")
chrom_options.add_argument("profile-directory=Profile 1")
user-data-dir considers profile as default , and you don't have to specify that . If its something else specify it through profile-directory argument
Step to create a profile:
open : chrome://version in address bar
copy the user dir folder completely to eg c:\tmp\newdir
open the copied user data (newdir) and search for folder called Default . This is the profile folder.
rename the Default folder as "Profile 1"
Now to use this :
chrom_options.add_argument("user-data-dir=c:\\tmp\\newdir")
chrom_options.add_argument("profile-directory=Profile 1")
Answered By - PDHide
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.