options_ = webdriver.ChromeOptions()
options_.add_argument("user-data-dir=C:\\Users\\Anton\\\\AppData\\Local\\Google\\Chrome\\User Data\\Default")
driver = webdriver.Chrome(executable_path='C:\chromedriver\chromedriver.exe', chrome_options=options_)
I am trying to use my current Chrome-profile as to avoid Captcha in my automation project.
To no avail, Selenium refuses to load any other profile but the temporary one. I'm I using the incorrect syntax? 'chrome_options = options_' gave me a deprecation message, but changing it to 'options=options_' made no difference in outcome
EDIT: Amit YR's comment solved my initial problem, Selenium now open Chrome with the correct user profile.
But now a new problem emerged. After the browser opens, the script stops with the following Error:
Traceback (most recent call last):
File "C:\Users\Anton\Documents\pytho.py", line 24, in <module>
driver = webdriver.Chrome(executable_path='C:\chromedriver\chromedriver.exe', options=options_)
File "C:\Users\Anton\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 81, in __init__
desired_capabilities=desired_capabilities)
File "C:\Users\Anton\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "C:\Users\Anton\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Users\Anton\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\Anton\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.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