【问题标题】:Is there a command line flag to enable flash for firefox?是否有命令行标志来为 Firefox 启用 Flash?
【发布时间】:2018-11-07 18:46:15
【问题描述】:

我正在进行自动化测试,但我不知道如何在启用/允许 Flash 的情况下启动我们的 Browserstack firefox 浏览器。

firefox 是否有启用/允许 flash 的标志?

我们使用 Karma 作为测试运行器。

我试过了:

var FirefoxProfile = require('firefox-profile');
var myProfile = new FirefoxProfile();
myProfile.setPreference("plugin.state.flash", 2);
myProfile.updatePreferences();

还有:

module.exports = function (config) {
    config.set({
        basePath: "",
        browserNoActivityTimeout: 60000,
        browserStack: {
            username: "myUsername",
            accessKey: "myAccessKey",
            forcelocal: true,
            timeout: 1000, 
            firefox_profile: myProfile
        },
        client: {
            mocha: {
                timeout: 60000,
                ui: interfaceType
            },
            useIframe: true
        },
        customLaunchers: {
            "bs_chrome_mac": {
                base: "BrowserStack",
                browser: "chrome",
                browser_version: "56",
                os: "OS X",
                os_version: "Sierra"
            },
            "firefox-osx" : {
                base: "BrowserStack",
                browser: "Firefox", 
                browser_version: "63.0",
                os: "OS X",
                os_version: "Sierra", 
                profile: myProfile
            },

【问题讨论】:

    标签: javascript firefox karma-runner browserstack


    【解决方案1】:

    您可以使用 ProfileManager 启动 firefox,创建一个启用 flash 的配置文件,以及一个不启用的配置文件。

    firefox -ProfileManager

    见:https://developer.mozilla.org/en-US/docs/Mozilla/Command_Line_Options?redirectlocale=en-US&redirectslug=Command_Line_Options

    【讨论】:

      【解决方案2】:
      For Firefox browser - 
      
       FirefoxProfile profile = new FirefoxProfile();
       profile.setPreference("plugin.state.flash", 2);
       caps.setCapability("browserstack.use_w3c", "true");
      

      上面提到的启用 flash 的代码 sn-p 是用 Java 编写的。您可以将它们移植到您选择的语言。

      【讨论】:

      • 你如何将它与 Karma 一起使用?
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-30
      • 2019-12-28
      • 1970-01-01
      • 1970-01-01
      • 2020-03-04
      • 2018-09-28
      相关资源
      最近更新 更多