fuzzii fuzzii - 1 year ago 295
TypeScript Question

How can we wait for the NOT conditions using protractor.ExpectedConditions?

I am currently working with Protractor and TypeScript, and I wish to implement a function that waits for the element text to not be something.

myElement: protractor.ElementFinder = $('#title');
myElement, '0'))
.then(() => return myElement.text();

How can I manipulate this so that I'm waiting for the element.text() to be something other than 0?

I realize that I can use the expect statement to check that the value is not 0, but I actually want to return a value from this function, and then check that the value is equal to another within a different class.

Any help would be greatly appreciated!

Answer Source

Protractor supports not operation in ExpectedCondition. Have a look at http://www.protractortest.org/#/api?view=ProtractorExpectedConditions.prototype.not

look at below example to solve your problem.

var EC = protractor.ExpectedConditions;
browser.wait(EC.not(EC.textToBePresentInElement(myElement, '0')),5000);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download