无法将foxyproxy插件添加到selenium配置文件中

2024-06-16 09:08:03 发布

您现在位置:Python中文网/ 问答频道 /正文

尝试向Firefox驱动程序添加FoxyProxy扩展时,如下所示:

from selenium.webdriver import FirefoxProfile, DesiredCapabilities
from selenium import webdriver

profile =FirefoxProfile()
firefox_capabilities = DesiredCapabilities.FIREFOX
firefox_capabilities['marionette'] = False
profile.add_extension(extension='res/foxyproxy@eric.h.jung.xpi')
profile.set_preference("extensions.logging.enabled", True)
driver = webdriver.Firefox(profile,capabilities=firefox_capabilities)

一切似乎都很好,但当窗口打开时,我看到没有安装FoxyProxy,浏览器控制台也会显示以下消息:

1566128038983   addons.xpi-utils    DEBUG   New add-on foxyproxy@eric.h.jung installed in app-profile
Blocklist::loadBlocklist: blocklist is disabled
1566128039076   addons.xpi-utils    WARN    Add-on foxyproxy@eric.h.jung is not correctly signed. 2
1566128039076   addons.xpi-utils    WARN    addMetadata: Add-on foxyproxy@eric.h.jung is invalid: Error: Extension foxyproxy@eric.h.jung is not correctly signed(resource://gre/modules/addons/XPIDatabase.jsm:2452:17) JS Stack trace: addMetadata@XPIDatabase.jsm:2452:17
processFileChanges@XPIDatabase.jsm:2809:26
checkForChanges@XPIProvider.jsm:2728:55
startup@XPIProvider.jsm:2265:12
callProvider@AddonManager.jsm:193:31
_startProvider@AddonManager.jsm:569:5
startup@AddonManager.jsm:725:14
startup@AddonManager.jsm:2797:26
observe@addonManager.js:65:29

这意味着扩展没有正确签名。xpi文件是通过直接从我的普通配置文件扩展文件夹复制获得的,所以我不明白为什么会出现此警告?它实际上是安装失败的根源


Tags: isonutilsfirefoxprofilewebdriverericaddons