Leo's question on 8/16/2019被标记为重复,但不是!我也明白了
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
我尝试过各种形式的选项和chrome峎选项,没有改变。我尝试了指定usedatadir和不指定usedatadir,然后只显示一个通用概要文件。在
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
但是,这些只显示了如何使用selenium,我很确定Leo和我已经在代码中编写了它,但是仍然会出现这个错误。救命啊!在
代码如下:
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")
它在Chrome中打开正确的概要文件,但同时给出InvalidArgumentException,get命令返回:
selenium.common.exceptions.WebDriverException: Message: chrome not reachable
目前没有回答
相关问题 更多 >
编程相关推荐