报错解决:selenium.common.exceptions.WebDriverException: Message: invalid argument: unrecognized capability: chromeOptions
详情:安装selenium和谷歌驱动后,运行报错。求教怎么解决。
以下是报错信息:
Traceback (most recent call last):
File "E:/Gordon/trackingnumber clawling1.4.py", line 88, in <module>
t = Track()
File "E:/Gordon/trackingnumber clawling1.4.py", line 34, in __init__
self.dr = webdriver.Chrome("C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe")
File "C:\Users\Administrator\Anaconda3\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 69, in __init__
desired_capabilities=desired_capabilities)
File "C:\Users\Administrator\Anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 98, in __init__
self.start_session(desired_capabilities, browser_profile)
File "C:\Users\Administrator\Anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 188, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Users\Administrator\Anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 256, in execute
self.error_handler.check_response(response)
File "C:\Users\Administrator\Anaconda3\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 194, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: invalid argument: unrecognized capability: chromeOptions
调用驱动的代码能贴出来吗?以及你的驱动版本和chrome版本是不是一致?
首先你要确定你C:\ProgramFiles(x86)\Google\Chrome\Application目录下确实有chromedriver.exe文件
然后
webdriver.Chrome(r"C:\ProgramFiles(x86)\Google\Chrome\Application\chromedriver.exe")
改下这句试试
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。