阻止显示Firefox附加首页 [英] Preventing Firefox add-on first page from showing up
问题描述
我正在使用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屋!