关于angularjs:量角器无法在Google Chrome中使用

Protractor not working in google chrome

我是Angle js中的量角器测试工具的新手,我安装了CORS扩展
在chrome浏览器中,我写了我的第一个测试用例,我尝试使用
``量角器config.js''chrome浏览器正在打开,实际上是登录表单,我输入了正确的用户名和密码,但未连接到服务器,我了解到CORS扩展已禁用,如何在运行测试时启用cors扩展 通过cmd的情况。

我的config.js

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
exports.config = {
    capabilities: {
          // You can use other browsers
          // like firefox, phantoms, safari, IE (-_-)


            'browserName': 'chrome'
    },
    specs: [
           // We are going to make this file in a minute
        '../www/modules/user/login.spec.js',
        //'../www/modules/lead/list.spec.js',

    ],
    jasmineNodeOpts: {
        showColors: true,
        //defaultTimeoutInterval: 30000,
        isVerbose: true,
    },
    allScriptsTimeout: 20000,
    onPrepare: function(){
        browser.driver.get('http://localhost:8100/');
    }
};

默认情况下,会启动一个没有安装任何扩展程序的完全干净的浏览器。

为了使用扩展程序启动Chrome,您需要适当地设置chromeOptionsextensions。 在这里您可以找到工作示例:

  • 是否可以在量角器测试下向chromedriver添加插件?


只需更改功能部分。 或者你可以按照alexe的答案。

1
2
3
4
5
6
7
8
    capabilities: {
              // You can use other browsers
              // like firefox, phantoms, safari, IE (-_-)


                'browserName': 'chrome',
                 chromeOptions': { 'args': ['--disable-web-security'] }
        },