【问题标题】:Selenium webdriver seems not working properly with Firefox 49.0. Am I missing something?Selenium webdriver 似乎无法在 Firefox 49.0 上正常工作。我错过了什么吗?
【发布时间】:2017-02-10 17:01:27
【问题描述】:

我已经完成了之前的问题,但没有发现其他人遇到我的问题。

这个简单的代码挂了

from selenium import webdriver
d = webdriver.Firefox();

浏览器启动,但它只是挂在那里。一段时间后,它崩溃了,我得到了错误

selenium.common.exceptions.WebDriverException: Message: Can't load the profile. 
Profile Dir: /tmp/tmpn_MQnf If you specified a log_file in the 
FirefoxBinary constructor, check it for details.

我在 Ubuntu 14.04 LTS 上有 Firefox49。我有 selenium 2.53.6 并阅读了之前的帖子,我升级到了 selenium 3.0.0.b3。我也下载了geckdriver,放到/usr/bin

看起来我仍在运行旧版本的 selenium。但是当我卸载它并安装 selenium 3.0.0.b3 时,我看到以下错误 -

selenium.‌​common.exceptions.We‌​bDriverException: 
Message: Service geckodriver unexpectedly exited. Status code was: 2 

我错过了什么?

【问题讨论】:

  • 看起来我还在运行旧版本的 selenium。但是当我卸载它并安装 selenium 3.0.0.b3 时,我看到以下错误 ------------------------------- -------------------------------------------------- ----------selenium.common.exceptions.WebDriverException:消息:服务 geckodriver 意外退出。状态码是:2
  • 查看 geckdriver.log 它说 -> 用法:geckodriver [OPTIONS] geckodriver:未知选项 --port

标签: python selenium firefox selenium-webdriver ubuntu-14.04


【解决方案1】:

尝试将下载的 Gecko 驱动程序重命名为 Wires 并设置功能,如下所述。

System.setProperty("webdriver.gecko.driver", "//home//.....//BrowserDrivers//wires");
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability("marionette", true);
Driver = new MarionetteDriver(capabilities);

我在 Linux Ubuntu 14.04 LTS 上的 FireFox 49 上尝试了上面的代码......代码在 Java 中对我来说很好...... 也尝试将 selenium WebDriver 从 Beta 降级到 2.53,因为 Beta 版本不稳定..

【讨论】:

    猜你喜欢
    • 2017-02-09
    • 1970-01-01
    • 1970-01-01
    • 2015-06-30
    • 1970-01-01
    • 1970-01-01
    • 2017-09-04
    • 2012-05-06
    • 2013-02-17
    相关资源
    最近更新 更多