【问题标题】:Open firefox devtools programmatically with FirefoxProfile使用 FirefoxProfile 以编程方式打开 firefox devtools
【发布时间】:2017-04-06 05:14:58
【问题描述】:

如何使用 selenium 和 Java 启动带有打开的 devtools 的 Firefox 52?

在将 Firebug 合并到 Firefox DevTools 之前,我使用 FirefoxProfile 以编程方式打开控制台:

profile.setPreference("extensions.firebug.console.enableSites", true);

等等。

但 Firebug 现在不再工作了。 那么使用打开的网络或控制台选项卡启动的正确方法是什么?

此外,是否有任何 FirePath 的模拟扩展可以自动启动并使用,而不是当前损坏的 FirePath 扩展?

【问题讨论】:

  • 感谢您的指正,并为我的英语不好感到抱歉。

标签: java selenium firefox firebug


【解决方案1】:

我设法使用 -devtools 参数从命令行打开了给定页面和原生开发工具的 Firefox:

firefox -no-remote -profile "c:\deleteme" -devtools -url "http://example.com/"

似乎可以通过调用将该参数传递给 WebDriver addCommandLineOptions("-devtools")FirefoxBinary 实例上。

(通过How can I tell selenium to start firefox with certain commandline options?。)


或者在 Node 中可能是 firefox.Options().setBinary(…).addArguments("-devtools")

firefox -help | more 中发现了该参数,但唉,似乎并非所有在那里提供的信息以及Command_Line_Options MDC page 提供的信息仍然有效。 -devtools 目前在 MDN 页面上丢失了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-10-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-27
    • 1970-01-01
    相关资源
    最近更新 更多