求助:python+selenium 启动 Chrome 时,加载用户配置文件,启动报错
依照网上的设置,代码如下:from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument('--profile-directory=Default')
options.add_argument('--user-data-dir=C:\Users\admin\AppData\Local\Google\Chrome\User Data\Profile 4')
browser = webdriver.Chrome(chrome_options=options)
报错信息如下:
Traceback (most recent call last):
File "C:/Users/admin/PycharmProjects/testdemo/555.py", line 11, in
browser = webdriver.Chrome(chrome_options=options)
File "C:\Python27\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 69, in init
desired_capabilities=desired_capabilities)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 92, in init
self.start_session(desired_capabilities, browser_profile)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 179, in start_session
response = self.execute(Command.NEW_SESSION, capabilities)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 238, in execute
self.error_handler.check_response(response)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 193, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot create default profile directory
(Driver info: chromedriver=2.28.455520 (cc17746adff54984afff480136733114c6b3704b),platform=Windows NT 10.0.14393 x86_64) 你这是导入登录的配置文件这个我还没有用过 黑盒测试 发表于 2017-3-15 13:59
你这是导入登录的配置文件这个我还没有用过
对的,因为webdriver每次启动都会对打开一个全新的浏览器,但是我们公司的项目如果取本地缓存的话,访问速度会快很多,所以我才想让webdiver启动一个带配置的浏览器,我是按照这篇博文来写的,有人实现过启动带用户配置的浏览器吗?
博文链接:http://blog.csdn.net/shuju_lover/article/details/52426074 没有人知道吗?:'( Сериал про космос - сериал звездные врата
页:
[1]