我目前正在使用Protractor和TypeScript,我希望实现一个等待元素文本的函数。
myElement: protractor.ElementFinder = $('#title');
browser.wait(protractor.ExpectedConditions.textToBePresentInElement(
myElement, '0'))
.then(() => return myElement.text();
我如何操纵这个以便我等待element.text()不是0?
我意识到我可以使用expect语句来检查该值是否为0,但我实际上想要从该函数返回一个值,然后检查该值是否等于另一个类中的另一个值。
任何帮助将不胜感激!
答案 0 :(得分:6)
量角器支持ExpectedCondition中的not
操作。看看http://www.protractortest.org/#/api?view=ProtractorExpectedConditions.prototype.not
请看下面的示例来解决您的问题。
var EC = protractor.ExpectedConditions;
browser.wait(EC.not(EC.textToBePresentInElement(myElement, '0')),5000);