Angularjs 量角器。在页面上执行一个操作后出现浏览器错误

Angularjs 量角器。在页面上执行一个操作后出现浏览器错误,angularjs,webdriver,protractor,Angularjs,Webdriver,Protractor,我是量角器的新手,现在我的工作需要为angularjs应用程序创建测试项目。 我从指导原则开始,在开始时遇到了错误: Error: Uncaught Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting! Watchers fired in the last 5 iterations: [] http://errors.angularjs.org/1.4.0/$rootScope/infdig?p0=10&

我是量角器的新手,现在我的工作需要为angularjs应用程序创建测试项目。 我从指导原则开始,在开始时遇到了错误:

Error: Uncaught Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
Watchers fired in the last 5 iterations: []
http://errors.angularjs.org/1.4.0/$rootScope/infdig?p0=10&p1=%5B%5D
http://localhost/main-f3fbd0c72e8415cd0a449214b66bdacc-cached.js:2140
    at window.onerror (http://localhost/main-f3fbd0c72e8415cd0a449214b66bdacc-cached.js:1277:52)
配置文件

  exports.config = {
    directConnect: true,

    seleniumAddress: 'http://localhost:4444/wd/hub',

    capabilities: {
       'browserName': 'chrome'
    },
    specs: ['specs/spec.js'],

    jasmineNodeOpts: {
       showColors: true,
       defaultTimeoutInterval: 30000
    }
};
测试文件:

    "use strict";

    describe('WEB test project', function() {

    var wl5StartPage = require('../pages/startPage.js');
      it('Its start login page', function() {
        wl5StartPage.get();  
        wl5StartPage.wl5Login();
    });
  });
startPage.js:

var WL5LoginPage = function() {

    this.userName = element(by.model('loginInfo.userId'));
    this.loginButton = element(by.css('[ng-click="login()"]'));

    this.get = function() {
        browser.get('http://localhost/login');
    };

    this.wl5Login = function() {    
        this.userName.sendKeys("user1");
        this.loginButton.click();
    };
}

module.exports = new WL5LoginPage();
这是一个非常简单的测试,但不幸的是,当我输入用户名并单击“登录”时,它崩溃了。 有没有办法忽略这些浏览器错误?还是用某种方法来解决问题


提前感谢您。

基本上,GragorJS代码没有什么问题。您之所以看到这一点,是因为您的角度应用程序抛出了此错误。量角器正在尝试等待页面上的角度-但无法。看起来你的错误和这个差不多-

我建议仅作为临时解决方案,禁用量角器的waitForAngular以调试测试:

browser.waitForAngularEnabled(false)

但我99%确信,这是必须在前端解决的问题,以允许平滑的测试自动化和自动等待


更新:您也可以尝试在量角器配置中启用此属性-

在规范中发布登录代码,以便我们知道发生了什么…是的,当然,登录代码添加到post中。