测试积点老人 发表于 2018-5-10 14:10:14

Day4-1测试积点任务

问题:
求助:python+selenium 启动 Chrome 时,加载用户配置文件,启动报错
依照网上的设置,代码如下:


<font face="微软雅黑" size="3">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)</font>


abcsell 发表于 2018-5-17 09:21:44

应该是没有响应

qqq911 发表于 2018-5-17 10:11:45

兼容性问题?

jingzizx 发表于 2018-5-17 10:19:55

看不出来,还有其他的吗

梦想家 发表于 2018-5-17 11:16:03

兼容性问题?

libingyu135 发表于 2018-5-17 14:20:05

无法创建默认配置文件目录,是不是啥东西没配好

libingyu135 发表于 2018-5-17 14:20:26

无法创建默认配置文件目录,是不是啥东西没配好
页: [1]
查看完整版本: Day4-1测试积点任务