Expected conditions in protractor

Once feat(expectedConditions) is in (probably protractor 1.7), you can do:

var EC = protractor.ExpectedConditions;
var e = element(by.id('xyz'));
browser.wait(EC.presenceOf(e), 10000);
expect(e.isPresent()).toBeTruthy();

Please note though, if you’re working with an Angular app and your test requires these conditional waits, it’s a big red flag for what you’re doing, as protractor should handle waits natively.

Leave a Comment