且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何访问我在 Selenium Webdriver 中添加的 Firefox 扩展?

更新时间:2023-11-29 21:27:40

这取决于扩展.通常,在创建 FF 配置文件时,可以通过设置适当的属性(您可以在 about:config 中找到的属性)在某种程度上控制扩展程序的行为.例如,在 FF 启动后默认打开 Firebug 窗口,我将在我的代码中包含以下行:

It depends on extension. Usually the extension's behaviour can be to some extent controlled by setting appropriate properties (the ones you can find in about:config) when creating an FF profile. For instance to have Firebug window open by default after FF starts I would include the following line in my code:

default_profile["extensions.firebug.allPagesActivation"] = true

我使用的扩展程序通常具有某种自动导出功能,可以自动将数据发送到服务器或将其保存在磁盘上.恐怕无法使用 WebDriver 控制扩展,因此并非所有扩展都可用于自动化测试.

The extensions I use usually have some kind of auto-export feature that automatically sends data to server or saves it on disk. I am afraid there is no way of controlling an extension with WebDriver so not all extensions will be usable in automated tests.