码迷,mamicode.com
首页 > 系统相关 > 详细

ubuntu系统下selenium打开火狐浏览器提示'Unable to find a matching set of capabilities.解决方法

时间:2019-06-25 11:42:56      阅读:1078      评论:0      收藏:0      [点我收藏+]

标签:matching   module   cut   cep   ges   root   comm   火狐浏览器   imp   

环境:

1、ubuntu系统

2、selenium 3.141.0

3、火狐浏览器驱动 geckodriver-v0.24.0-linux32

在Python中执行脚本:

from selenium import webdriver
browser = webdriver.Firefox()

结果提示:Message: Unable to find a matching set of capabilities

Traceback (most recent call last):
  File "/home/yanner/seleniumtest/sousuo.py", line 2, in <module>
    browser = webdriver.Firefox()
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 174, in __init__
    keep_alive=True)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities

解决方法:更新firefox浏览器

1、从浏览器进入firefox官网下载最新版本Firefox-latest.tar.bz2

2、进入下载目录,将该文件解压。

3、打开终端模拟器,进入到下载目录,输入安装命令行。

root@yanner-VirtualBox:/home/yanner/下载/firefox# sudo apt-get install firefox
更新后,Firefox 52.0.2

再次执行脚本,正常打开浏览器。

ubuntu系统下selenium打开火狐浏览器提示'Unable to find a matching set of capabilities.解决方法

标签:matching   module   cut   cep   ges   root   comm   火狐浏览器   imp   

原文地址:https://www.cnblogs.com/yanner/p/11081861.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!