运行Selenium 2时在Firefox中激活Firebug的最佳方法是什么?
What's the best way to activate Firebug in Firefox when running Selenium 2?
编辑:好的,我知道最佳可以解释,但是配置文件 - 基于解决方案真的曾经是硒1.0的痛苦。因此,除非证明更糟,否则任何替代方案都会被认为更好;)
Ok, I realize "best" is open to interpretation, but the profile-based solution really used to be a pain with selenium 1.0. So any alternative is considered better until proved worse ;)
推荐答案您可以在代码中创建配置文件并动态添加所需的附加组件。假设您将Firebug XPI作为firebug.xpi保存到C:\ FF_Profile文件夹中(转到 Firebug下载页面,右键单击添加到Firefox并保存为C:\ FF_Profile\firebug.xpi)。
You can create your profile in code and dynamically add required add-ons. Let's assume that you saved Firebug XPI into the C:\FF_Profile folder as firebug.xpi (go to Firebug download page, right-click on the "Add To Firefox" and save as C:\FF_Profile\firebug.xpi).
代码:
final String firebugPath = "C:\\FF_Profile\\firebug.xpi"; FirefoxProfile profile = new FirefoxProfile(); profile.addExtension(new File(firebugPath)); // Add more if needed WebDriver driver = new FirefoxDriver(profile);这在 WebDriver常见问题解答
更多推荐
如何在Selenium WebDriver(Selenium 2)中运行Firebug?
发布评论