【问题标题】:selenium works only 2.53.6 with firefox 45.0.2selenium 仅适用于 2.53.6 与 firefox 45.0.2
【发布时间】:2016-12-23 17:16:57
【问题描述】:

我在 Python 2.7 上使用 selenium,它仅在使用与 firefox 45.0.2 关联的 2.53.6 版本时才有效。任何其他版本,返回此错误或类似错误:

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

每天至少有一个Firefox更新,我尝试了很多解决方案来避免这种情况,但我仍然需要运行

sudo apt-get install firefox=45.0.2+build1-0ubuntu1

我创建了一个 cron 作业来为我做这件事,但由于某种原因,它不起作用。

这是shell文件

#!/bin/bash
PATH=/opt/someApp/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
SHELL=/bin/sh PATH=/bin:/sbin:/usr/bin:/usr/sbin 

sudo apt-get install --allow-downgrades -y  firefox=45.0.2+build1-0ubuntu1 >> logs2.txt

这是我尝试过的一些 cron 作业(来自 crontab -e):

32 * * * * root (apt-get install --allow-downgrades -y  firefox=45.0.2+build1-0ubuntu1)
32 * * * * /home/stefanolinux/firefox_update.sh >> firefox_update_works.txt

作为根:

@hourly apt-get install firefox=45.0.2+build1-0ubuntu1
32 * * * * apt-get install --allow-downgrades -y  firefox=45.0.2+build1-0ubuntu1

更令人沮丧的是,当从 Windows 运行时,相同的脚本无需任何降级即可运行(对于 firefox 和 selenium)。有什么建议吗?

【问题讨论】:

标签: python selenium firefox crontab ubuntu-16.04


【解决方案1】:

您可以停止更新。从菜单中选择options

选择“高级”->“更新”选项卡->“从不检查更新”

最后一次降级 FireFox。

【讨论】:

  • 不幸的是,我已经尝试过该解决方案,但没有奏效。无论如何,当我远程运行脚本并且需要通过终端工作时,它不会解决问题
【解决方案2】:

使用sudo apt-mark hold firefox解决

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-02-03
    • 1970-01-01
    • 2013-04-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-25
    • 2016-12-06
    相关资源
    最近更新 更多