我在python中使用selenium,并尝试使用一些参数来启动chromedriver。
from selenium import webdriver
from selenium.webdriver.chrome.options import Options as ChromeOptions
def buildDriver():
options = ChromeOptions()
options.add_argument('--profile-directory="Default"')
options.add_argument('--user-data-dir="C:/Temp/ChromeProfile"')
browser = webdriver.Chrome(chrome_options=options)
driver = buildDriver()
我无法找到解决以下错误的方法:
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot create default profile directory
搜索这个错误不会产生任何有意义的结果,至少对我来说不是。
原来在添加参数时不能使用引号。
注意它是
--profile-directory=Default
,而不是--profile-directory="Default"
这就是我解决问题的原因。
相关问题 更多 >
编程相关推荐