Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/434.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
Javascript 在angularjs应用程序中使用量角器测试按钮点击_Javascript - Fatal编程技术网

Javascript 在angularjs应用程序中使用量角器测试按钮点击

Javascript 在angularjs应用程序中使用量角器测试按钮点击,javascript,Javascript,我收到以下错误:- describe("holiday calendar", function() { var ptor = protractor.getInstance(); ptor.ignoreSynchronization = true; var elem=ptor.findElement(protractor.By.id('holidayId')); elem.click().then(function(){ ptor.waitForAngular(); i

我收到以下错误:-

describe("holiday calendar", function() {
 var ptor = protractor.getInstance();
 ptor.ignoreSynchronization = true;
 var elem=ptor.findElement(protractor.By.id('holidayId'));
 elem.click().then(function(){
     ptor.waitForAngular();
     it('holiday list length', function() {
        var list = element.all(by.repeater('holiday in holidayList'));
        expect(list.count()).toEqual(10);
     });
 });
});

您很难确定
it()
块的作用域,另外,如果您升级了量角器,而不是使用
量角器。getInstance()
您可以开始使用
浏览器
语法,如下所示:

var template = new Error(this.message);
ElementNotVisibleError: element not visible
  (Session info: chrome=36.0.1985.125)
  (Driver info: chromedriver=2.10.267518,platform=Linux 3.8.0-44-generic x86_64)
   at new bot.Error (/home/sanjay/Documents/SanjayPrusti/AngularJs/LMS-Soujanya
 /node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/error.js:109:18)
describe("holiday calendar", function() {
    // Should move this to a page object eventually:
    var holidayLinkElm = $('#holidayId');

    it('tests a non-angular page', function() {
        browser.ignoreSynchronization = true;
    });

    it('shows the holiday link', function() {
        expect(holidayLinkElm.isPresent()).toBeTruthy();
        expect(holidayLinkElm.isDisplayed()).toBeTruthy();
    });

    it('clicks holiday link', function() {
        holidayLinkElm.click();
    });

    it('switches now to an angular page', function() {
        // browser.waitForAngular() is not necessary after restoring this:
        browser.ignoreSynchronization = false;
    });

    it('validates holiday list length', function() {
        var list = element.all(by.repeater('holiday in holidayList'));
        expect(list.count()).toEqual(10);
    });
});