[英]How to install add-on on a remote Firefox webdriver?
install_addon
is a method on the Firefox webdriver, but I'm running tests remotely. install_addon
是 Firefox webdriver 上的一种方法,但我正在远程运行测试。 How can I install an add-on to a driver like the following:如何为驱动程序安装附加组件,如下所示:
driver = webdriver.Remote(
command_executor=SELENIUM_URL,
desired_capabilities=webdriver.DesiredCapabilities.FIREFOX
)
? ? It looks like creating a
webdriver.FirefoxProfile()
and using add_extension()
should work, but it's currently broken .看起来创建一个
webdriver.FirefoxProfile()
并使用add_extension()
应该可以工作,但它目前已损坏。
The use case is testing the effect of Firefox add-on manifest.json's all_frames
property.该用例正在测试 Firefox 附加组件 manifest.json 的
all_frames
属性的效果。
Аfter a long search and visits on this topic from google i found solution经过长时间的搜索和从谷歌访问这个主题,我找到了解决方案
Install addon in you Firefox profile from browser, save it and set him into webdriver options.从浏览器在您的 Firefox 配置文件中安装插件,保存它并将其设置为 webdriver 选项。
firefox
browserfirefox
浏览器about:profiles
about:profiles
about:profile
in Root Directory
section)about:profile
in Root Directory
部分)from selenium.webdriver import FirefoxOptions, FirefoxProfile, Remote
# init options object
options = FirefoxOptions()
# init profile object with path to you profile
profile = FirefoxProfile('{path_to_your_profile_folder}')
# set profile into options
options.profile = profile
# init you Remote browser with created options (commented arguments for example)
driver = Remote(
options=options,
# command_executor= ...,
# desired_capabilities=...
)
It`s works for me.它对我有用。 The disadvantage of this solution is the presence of a folder with a profile that needs to be stored somewhere
此解决方案的缺点是存在一个文件夹,其中包含需要存储在某处的配置文件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.