第三个参数
browser.wait()是自定义错误消息:
browser.wait(EC.textToBePresentInElement(element(by.binding('myvar')), "expected"), 5000, "Text is not something I've expected");
要等待元素包含任何文本,可以编写 自定义期望条件 :
var EC = protractor.ExpectedConditions;var anyTextToBePresentInElement = function(elementFinder) { var hasText = function() { return elementFinder.getText().then(function(actualText) { return actualText; }); }; return EC.and(EC.presenceOf(elementFinder), hasText);};
这是用法:
browser.wait(anyTextToBePresentInElement(element(by.binding('myvar'))), 5000);
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)