【发布时间】:2020-07-21 12:38:13
【问题描述】:
我正在验证文本框是否为空。我不确定我在这里做错了什么。
Page Object method
async getTextVal(){
await this.t.selectText(this.editor) //selecting the text box
return this.editor.innerText; //fetching the value in the textbox
}
TestCase
await t.expect(element.getTextVal()).eql(''); //assert statement
如果存在值,则 getTextVal 可以正常工作。但是检查空值它失败了
【问题讨论】:
-
你好。你遇到了什么错误? (stackoverflow.com/help/minimal-reproducible-example)
-
1) 尝试在 Promise 对象上运行断言。你忘了等待吗?如果不是,则将“{allowUnawaitedPromise: true }”传递给断言选项。这就是我所看到的。我试过“{allowUnawaitedPromise: true }”但没有运气
标签: javascript java selenium automation testcafe