无法 运行 Internet Explorer 11 上的量角器

Cannot run protractor on Internet explorer 11

我正尝试 运行 在 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

有什么想法吗?

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

directConnect: true - Your test script communicates directly Chrome Driver or Firefox Driver, bypassing any Selenium Server. If this is true, settings for seleniumAddress and seleniumServerJar will be ignored. If you attempt to use a browser other than Chrome or Firefox an error will be thrown.

你需要remove/comment出directConnect:

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

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

你的配置文件如下所示

</p>

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

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