【问题标题】:Cannot run protractor on Internet explorer 11无法在 Internet Explorer 11 上运行量角器
【发布时间】:2015-03-09 11:33:17
【问题描述】:

我正在尝试在 IE11 上运行我的 jasmine E2E 测试,但没有任何运气。 我在 Windows 8.1 上。 我的配置:

exports.config = {
    directConnect: true,

    // Capabilities to be passed to the webdriver instance.
    capabilities: {
        'browserName': 'chrome'
    },

    // run in multiple browsers
    multiCapabilities:[
     //    {
     //        'browserName': 'chrome'
     //    },
        // {
     //        'browserName': 'firefox'
     //    },       
        {
           'browserName': 'internet explorer',
        }
    ],

    // Spec patterns are relative to the current working directly when
    // protractor is called.
    specs: ['./**/*js'],

    // Options to be passed to Jasmine-node.
    jasmineNodeOpts: {
        showColors: true,
        defaultTimeoutInterval: 30000
    },

    onPrepare: function () {
        // The require statement must be down here, since jasmine-reporters@1.0
        // needs jasmine to be in the global and protractor does not guarantee
        // this until inside the onPrepare function.
        require('jasmine-reporters');
        jasmine.getEnv().addReporter(
            new jasmine.JUnitXmlReporter('xmloutput', true, true)
        );
    }
};

Chrome 和 Firefox 的工作就像一个魅力,但 IE 给了我这个:

Error: browserName (internet explorer) is not supported with directConnect.

IEDriverServer.exe 已添加到我的路径中。我已经完成了所有需要的配置:https://code.google.com/p/selenium/wiki/InternetExplorerDriver#Required_Configuration

有什么想法吗?

【问题讨论】:

    标签: angularjs node.js testing protractor internet-explorer-11


    【解决方案1】:

    根据Connecting Directly to Browser Drivers directConnect 设置仅适用于 Firefox 和 Chrome:

    directConnect: true - 您的测试脚本直接与 Chrome 通信 驱动程序或 Firefox 驱动程序,绕过任何 Selenium 服务器。如果这是 true,seleniumAddress 和 seleniumServerJar 的设置将是 忽略。 如果您尝试使用 Chrome 或 Firefox 以外的浏览器 将抛出错误

    您需要删除/注释掉directConnect

    exports.config = {
        multiCapabilities:[
            {
               'browserName': 'internet explorer'
            }
        ],
        ...
    }
    

    仅供参考,您实际上可以将 capabilitiesmultiCapabilities 一起定义,但在这种情况下,protractor 会简单地忽略 capabilities 并使用 multiCapabilities (docs)。

    【讨论】:

    【解决方案2】:

    您的配置文件如下所示

    
    
    

    exports.config = { multiCapabilities: { 'browserName': 'internet explorer',
    }, framework: 'jasmine', specs: ['example_spec.js'], jasmineNodeOpts: { defaultTimeoutInterval: 30000 } };

    【讨论】:

      【解决方案3】:

      直接连接支持 Chrome 和 Firefox 浏览器。不过,它对 Internet Explorer 的作用不同。

      【讨论】:

      • 您照原样复制了别人的答案。请添加更多信息,告诉我们您的答案为何不同。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-12-09
      • 1970-01-01
      • 2014-06-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-07
      相关资源
      最近更新 更多