【问题标题】:Python Selenium Firefox driver - Disable ImagesPython Selenium Firefox 驱动程序 - 禁用图像
【发布时间】:2016-04-17 07:05:08
【问题描述】:

在我使用下面的代码之前,但它不再适用于 firefox 更新。

from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
firefoxProfile = FirefoxProfile()
firefoxProfile.set_preference('permissions.default.image', 2)

我也在下面尝试了这个,看起来不错,但是有没有办法在没有附加组件或 3rd 方工具的情况下禁用图像?

from selenium import webdriver
firefox_profile = webdriver.FirefoxProfile()
firefox_profile.add_extension(folder_xpi_file_saved_in + "\\quickjava-2.0.6-fx.xpi")
firefox_profile.set_preference("thatoneguydotnet.QuickJava.startupStatus.Images", 2)  ## Turns images off

【问题讨论】:

  • 设置 permissions.default.image 在 Firefox 66.0.5 上适用于我。

标签: python image selenium selenium-firefoxdriver loadimage


【解决方案1】:

您是否尝试过在 Firefox 更新后更新您的 selenium?

例如:

sudo -H pip install --upgrade selenium

【讨论】:

  • 它是最新的。其实这就是问题所在。因为第一个代码之前有效,在 firefox 和 selenium 更新之后,它不再有效。
  • 啊,好吧。我提到这一点是因为该语句(之前运行良好):driver = webdriver.Firefox() 开始给我这个错误:WebDriverException:消息:无法加载配置文件。 Profile Dir: %s 如果您在 FirefoxBinary 构造函数中指定了 log_file,请检查它以获取在 selenium 更新后得到解决的详细信息。
猜你喜欢
  • 2016-04-04
  • 2017-03-03
  • 2021-05-30
  • 2014-11-05
  • 2013-04-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多