Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 使用量角器选择器和可能的同步问题_Angularjs_Selenium_Selenium Webdriver_Protractor - Fatal编程技术网

Angularjs 使用量角器选择器和可能的同步问题

Angularjs 使用量角器选择器和可能的同步问题,angularjs,selenium,selenium-webdriver,protractor,Angularjs,Selenium,Selenium Webdriver,Protractor,我做e2e测试相当幼稚。该站点的前两个页面角度较小,因此我使用driver.findelement来处理它们,将ignore synchronization设置为true: it('should go to login page on pressing button',function(){ driver.get('http://localhost:54080/'); driver.findElement(by.id('loginButton')).click();

我做e2e测试相当幼稚。该站点的前两个页面角度较小,因此我使用driver.findelement来处理它们,将ignore synchronization设置为true:

  it('should go to login page on pressing button',function(){
    driver.get('http://localhost:54080/');
    driver.findElement(by.id('loginButton')).click();
    expect(driver.getCurrentUrl()).toContain('Account/Login');
  });
等等。在到达角度偏小的部分时,不再忽略同步,但是,我希望能够使用量角器选择器,如按型号

ptor.findElement(protractor.By.model('item.Title'))
我发现这给了我一个同步错误:

Error while waiting for Protractor to sync with the page: {...

我已经尝试了很多东西,但在测试中我做的很少。时间方面,它主要是以模糊的功能风格编写的。我没有轮询任何内容,所以它应该相当简单,我几乎确信这是一个时间或同步问题,与大多数文档的一般风格不同

量角器正在等待所有AngularJS$timeout和$http调用完成,然后再进行下一个测试。我知道,默认情况下,它会在11秒后超时。如果您使用$timeout进行轮询,或者在页面首次加载时有大量$http调用,那么很容易达到此限制


我解决问题的方法是将量角器配置中的allScriptsTimeout属性增加到30000 30秒

为了更新,当我将IgnoreSynchronization设置为true时,测试工作正常-不确定这可能会产生什么影响。请不要忘记按F12键,查看在此延迟期间网络层发生了什么。它可以帮助你更多地了解正在发生的事情。