阻止显示Firefox附加首页 [英] Preventing Firefox add-on first page from showing up

查看:109
本文介绍了阻止显示Firefox附加首页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am writing a Python program using Selenium Webdriver api that utilizes Firefox browser to browse, and I need the first page of the add on that shows it's version to be disabled and not gets shown when the browser gets to work. My add-on is NoScript.

这是我的Firefox个人资料代码:

Here is my code for Firefox profile :

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)

但是,此行不会阻止启动窗口出现:

However, this line doesn't prevent the starting windows from showing up:

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

问题出在哪里,我该如何解决?

What is the problem and how do I fix it?

推荐答案

noscript首选项以noscript开头(不需要extensions.).并且您需要设置version而不是currentVersion.为我工作:

noscript preferences start with noscript (no need for extensions.). And you need to set the version instead of currentVersion. Works for me:

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

这篇关于阻止显示Firefox附加首页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆