Reputation: 11
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);
});
});
});
i am getting the following error:-
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)
Upvotes: 1
Views: 277
Reputation: 16722
You're having a hard time scoping your it()
block, plus if you upgrade protractor, instead of using protractor.getInstance()
you can start using browser
syntax like this:
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);
});
});
Upvotes: 1