我想加载Firefox插件请求策略。我就是这样尝试的:
rp = open(wd + "/requestpolicy.xpi")
firefoxProfile = FirefoxProfile()
firefoxProfile.add_extension(rp)
self.driver = webdriver.Firefox(firefoxProfile)
self.usr = user.User(self.driver, username, password, world)
self.usr.login()
没有错误,according to the Docs它应该可以工作,但它不能工作,它仍然在没有加载项的情况下启动。
接下来我试着这样称呼它:
self.driver = webdriver.Firefox(browser_profile=firefoxProfile)
输出:
TypeError: __init__() got an unexpected keyword argument 'browser_profile'
但这是python的一个方面,我不太了解。我有这个想法是因为source看起来是那样的。
我所做和工作的是:
另外,您不应该直接打开xpi文件。相反,试着给出地址:
我没有足够的Stackoverflowrep来对你的问题发表评论,不幸的是,我不知道你的问题的答案,但是对于什么值得你调用
webdriver.Firefox()
的firefox配置文件,而不是像你所做的那样。另请参见:http://code.google.com/p/selenium/source/browse/trunk/py/selenium/webdriver/firefox/webdriver.py#33
相关问题 更多 >
编程相关推荐