ssharma
ssharma

Reputation: 941

how to wait for element to display

how to wait until element is display : I am using following:

this.IncList = element.all(by.repeater("incident in $ctrl.allIncidents"));

browser.wait(IncList.count() > 0, 10000,"Element not visible timing out"); 

and Getting following error:

 Failed: fn is not a function[0m
 Stack:
TypeError: fn is not a function
    at C:\Local_E2E\analytics-qa\TestAutomation\SeleniumFramework\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:720:12
    at goog.async.run.processWorkQueue (C:\Local_E2E\analytics-qa\TestAutomation\SeleniumFramework\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\async\run.js:130:15)
    at process._tickCallback (node.js:369:9)
From: Task: <anonymous>
    at goog.async.run.processWorkQueue (C:\Local_E2E\analytics-qa\TestAutomation\SeleniumFramework\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\async\run.js:130:15)
    at process._tickCallback (node.js:369:9)
From: Task: Element not visible timing out
    at [object Object].webdriver.WebDriver.wait (C:\Local_E2E\analytics-qa\TestAutomation\SeleniumFramework\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:716:21)

Upvotes: 1

Views: 1862

Answers (1)

Brine
Brine

Reputation: 3731

You can use ExpectedConditions to wait for visibility, or a number of other conditions. Something like this should work for you:

var EC = protractor.ExpectedConditions;
this.IncList = element.all(by.repeater("incident in $ctrl.allIncidents"));
// visibility of the _one_ of the elements
browser.wait(EC.visibilityOf(this.IncList.first()), 10000,"Element not visible timing out");

Upvotes: 1

Related Questions