【发布时间】:2020-07-03 16:22:33
【问题描述】:
我有一些代码
browser.wait(ExpectedConditions.presenceOf(elementName));
这通常会失败,只是说“预期为真为假”。这让我很头疼。当它失败时,我希望它给我一个更具描述性的原因,为什么它与 elementName 一起失败。
所以我想更改它以添加消息。 browser.wait 定义为:
wait(condition: WebElementCondition, opt_timeout?: number, opt_message?: string): WebElementPromise;
所以我可以这样做:
browser.wait(ExpectedConditions.presenceOf(element), 0, `Expected presence of ${elementName}`);
但我不想在不需要时更改 opt_timeout。有什么方法可以在不通过 opt_timeout 的情况下传递 opt_message?
【问题讨论】:
标签: angular typescript selenium protractor