python中用selenium调Firefox报错问题

python在用selenium调Firefox时报错:

Traceback (most recent call last):
  File "G:\python_work\chapter11\test_selenium_firefox.py", line 10, in <module>
    driver = webdriver.Firefox()
  File "C:\Python34\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 154, in __init__
    keep_alive=True)
  File "C:\Python34\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 140, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "C:\Python34\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 229, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "C:\Python34\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 297, in execute
    self.error_handler.check_response(response)
  File "C:\Python34\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 194, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Unable to find a matching set of capabilities

=============================

python版本3.4.3 , selenium版本3.4.3 , Firefox版本49.0.

报错的原因是python, selenium, Firefox之间的版本兼容问题 , 将Firefox升级到最新版55.0后问题解决.

同时selenium在调用Firefox时需要geckodriver , 下载后添加到Firefox安装目录, 同时添加Firefox安装目录到系统环境变量Path.

=============================

测试代码:

1 from selenium import webdriver
2
3 driver = webdriver.Firefox()
4 driver.get("http://www.baidu.com")
时间: 2024-10-01 08:27:50

python中用selenium调Firefox报错问题的相关文章

Selenium Grid 运行报错 Exception thrown in Navigator.Start first time -&gt;Error forwarding the new session Empty pool of VM for setup Capabilities

Selenium Grid 运行报错 : Exception thrown in Navigator.Start first time ->Error forwarding the new session Empty pool of VM for setup Capabilities [{platform=WINDOWS, ensureCleanSession=true, ignoreProtectedModeSettings=true, ignoreZoomSetting=true, enab

python 读取数据库,老是报错。

在8.04.4环境下(其实我觉得跟环境无关,是我语句有问题): $ dpkg -l | grep -i python ii  libapache2-mod-python                 3.3.1-2build1               Apache 2 module that embeds Python within th ii  moinmoin-common                       1.5.8-5.1ubuntu2.5          Python

python安装模块的时候报错error: command &#39;gcc&#39; failed with exit status 1

[情况] 在写Python代码的时候,需要用到psutil模块,需要安装. 但是在安装时,报错:error: command 'gcc' failed with exit status 1 [解决步骤] 按照经验,觉得应该是缺少了gcc模块, 所以操作 [ yum install -y gcc ] 安装完成后,再继续安装psutil还是报同样的错,发现报错不是  not found gcc,可能是某个功能模块缺失 发现需要安装多一些依赖的包:  [ yum install -y libffi-d

Python读取CSV文件,报错:UnicodeDecodeError: &#39;gbk&#39; codec can&#39;t decode byte 0xa7 in position 727: illegal multibyte sequence

Python读取CSV文件,报错:UnicodeDecodeError: 'gbk' codec can't decode byte 0xa7 in position 727: illegal multibyte sequence 解决办法: 在语句open(sFileName,newline='')中,增加encoding='UTF-8',如下: open(sFileName,newline='',encoding='UTF-8') Python读取CSV文件,报错:UnicodeDecode

解决《利用python进行数据分析》P139报错问题 index must be monotonic increasing or decreasing

解决<利用python进行数据分析>P139报错问题 index must be monotonic increasing or decreasingframe.reindex(index=['a','b','c','d'],method='ffill',columns=states)报错:index must be monotonic increasing or decreasing 修改代码:把method=‘ffill’拿出来注意,是method的方法,参数ffill后面加"(

解压版本Python,手动安装pip报错,pip得到报错&quot; No module named &#39;pip&#39; &quot;

解压版本Python,手动安装pip报错 λ pip Traceback (most recent call last): File "runpy.py", line 193, in _run_module_as_main File "runpy.py", line 86, in _run_code File "D:\tools\python-3.8.1-embed-amd64\Scripts\pip.exe\__main__.py", line

python+selenium Remote 启动firefox报错总结

#coding=utf-8 from selenium.webdriver import Remote dr = Remote(command_executor='http://127.0.0.1:4444/wd/hub', desired_capabilities={'platform':'ANY', 'browserName':'firefox', 'version':'', 'javascriptEnabled':True } ) dr.get("https://www.baidu.com

关于action的使用在firefox报错的问题

现在的网站有很多都是鼠标移到上面去才会显示出相应的一些标签之类的东西,然后再进行操作,但是因为要操作的元素一开始是隐藏的,就没办法直接定位,只能调用action来模拟鼠标悬停操作,也就是下面这句代码: dr.action.move_to(element).perform 但是,同样的一句代码,在驱动firefox运行就会报错,在驱动chrome和IE就能成功运行,这实在是不科学呀,不可能是代码的问题啊.search了很久终于在http://stackoverflow.com/questions/

新装python环境启动django程序报错

个人独立博客 http://www.xbman.cn/ 出处:http://www.xbman.cn/article/1 django启动报错 django.core.exceptions.ImproperlyConfigured: Error loading either pysqlite2 or sqlite3 modules (tried in that order): No module named _sqlite3 解决方法 centos yum install python-deve