Leo's question on 8/16/2019 was marked duplicate, yet was not! I too get the error
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
I've tried various forms of options and chrome_options with no change. I tried with and without specifying the use-data-dir, which then just brings up a generic profile.
DebanjanB reported
This question already has an answer here:
How to open a Chrome Profile through Python
How to open a Chrome Profile through --user-data-dir argument of Selenium
However, these only show how to use selenium, which I am pretty sure Leo and I have written in the code, yet still get this error. Help!
Here is the code:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
CrOptions = Options()
ProfilePath = "C:\\Users\\name\\AppData\\Local\\Google\\Chrome\\User Data\\"
CrOptions.add_argument("user-data-dir=" + ProfilePath)
ProfileName = "Profile 3"
CrOptions.add_argument("profile-directory=" + ProfileName)
browser = webdriver.Chrome(options=CrOptions)
browser.get("HTTP://msftconnectiontest.com/redirect")
It opens up the correct profile in Chrome, but meanwhile gives the InvalidArgumentException and the get command returns:
selenium.common.exceptions.WebDriverException: Message: chrome not reachable