sunshine
管理员
管理员
  • 最后登录2023-10-30
  • 发帖数170
  • 社区居民
阅读:10188回复:0

关于webdreiver error: Unable to find a matching set of capabilities

楼主#
更多 发布于:2018-01-23 13:14

from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
# webdriver.Firefox() 找firefox 默认安装 路径
driver = webdriver.Firefox()
driver.get('http://baidu.com')


执行上面代码时,提示以下错误:


selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities

原因:geckodriver.exe 的版本不对,与selenium 与firefox 的版本不兼容


解决方案:使用互相兼容的版本,我使用的环境为 selenium 3.8  与 firefox 50 ,geckodriver v0.15 版本


注:在我的操作系统上,使用geckodriver v0.15 , 可以打开firefox , 但是打不开对应的网址。 而同事的机子上是可以定位到网址的。然后,将geckodriver.exe 升级到v0.16版本,问题解决。 然而,奇怪的是同事的电脑geckodriver.exe升级到v0.16反而不能定位到网址了,v0.15到是没有问题,总结:可能是由于系统原因
游客


返回顶部

公众号

公众号