I want to use selenium with my Google profile, I created this code:
options = webdriver.ChromeOptions()
options.add_argument(r"user-data-dir=C:\Users\myprofile\AppData\Local\Google\Chrome\User Data") #Path to my chrome profile
driver = webdriver.Chrome(executable_path=r"C:\chromedriver.exe", options=options)
driver.get(url)
I got this error:
InvalidArgumentException: Message: invalid argument: user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir
I also tried another profile, but return the same error:
options = webdriver.ChromeOptions()
options.add_argument('--user-data-dir=C:/Users/mxs/AppData/Local/Google/Chrome/User Data')
options.add_argument('--profile-directory=Profile 2')
driver = webdriver.Chrome(executable_path=r"C:\chromedriver.exe", options=options)
driver.get(url)
also, I tried codes in both Jupyter Notebook and VSCode