'Running selenium script requires all Chrome windows to be closed using Selenium Chrome
Using selenium, I'm trying to open a specific chrome profile. I can succesfully do so, but it can only run if I dont have any chrome windows open when I run it – if I do have one open, it opens a chrome window, doesn't get the website, and gives the following error:
Exception has occurred: 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'd like for my code to open a specific profile and for it not to matter if I have other chrome windows running.
The following is my current code (again, it opens the right profile but I cant have ANY other chrome windows (no matter the profile) when it's run):
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
options = webdriver.ChromeOptions()
options.add_argument("user-data-dir=C:\\Users\\jack_l\\AppData\\Local\\Google\\Chrome\\User Data")
options.add_argument(r'--profile-directory=Profile 8')
driver = webdriver.Chrome(ChromeDriverManager().install(), options=options)
driver.get("https://www.beatstars.com/")
Any help would be greatly appreciated.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
