gpt4 book ai didi

python - 防止 Firefox 附加组件第一页显示

转载 作者:太空宇宙 更新时间:2023-11-04 03:28:39 25 4
gpt4 key购买 nike

我正在使用 Selenium Webdriver api 编写一个 Python 程序,该程序利用 Firefox 浏览器进行浏览,我需要添加的第一页显示它的版本被禁用,并且在浏览器开始工作时不显示。我的插件是 NoScript。

这是我的 Firefox 配置文件代码:

def fpp():
ffprofile = webdriver.FirefoxProfile()
ffprofile.add_extension(extension='NS.xpi')
ffprofile.set_preference("extensions.noscript.currentVerison" , "2.6.9.35")
ffprofile.update_preferences()
return webdriver.Firefox(ffprofile)

def driver(url1):
m = fpp()
m.get(url1)

但是,此行不会阻止显示启动窗口:

ffprofile.set_preference("extensions.noscript.currentVerison" , "2.6.9.35")

问题是什么,我该如何解决?

最佳答案

noscript 首选项以 noscript 开头(不需要 extensions.)。并且您需要设置 version 而不是 currentVersion。对我有用:

ffprofile.set_preference("noscript.version", "2.6.9.35")

关于python - 防止 Firefox 附加组件第一页显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32015040/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com