【问题标题】:Protractor not working in google chrome量角器在谷歌浏览器中不起作用
【发布时间】:2019-08-01 12:25:51
【问题描述】:

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

我的 config.js

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/');
    }
};

【问题讨论】:

    标签: angularjs protractor


    【解决方案1】:

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

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

    【讨论】:

    • 谢谢你,我终于明白了
    • capabilities: { // 你可以使用其他浏览器 // 比如 firefox, phantoms, safari, IE (-_-) 'browserName': 'chrome', 'chromeOptions': { 'args': ['--disable-web-security'] } }
    【解决方案2】:

    只需更改功能部分。或者你可以关注 alex 的回答。

        capabilities: {
                  // You can use other browsers
                  // like firefox, phantoms, safari, IE (-_-)
    
    
                    'browserName': 'chrome',
                     chromeOptions': { 'args': ['--disable-web-security'] }
            },
    

    【讨论】:

      猜你喜欢
      • 2011-02-15
      • 2020-04-11
      • 1970-01-01
      • 1970-01-01
      • 2012-10-12
      • 2016-01-25
      • 2013-10-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多