我想使用 testcafe 框架编写一个测试,检查字段是否具有预期值。对于 REST 响应,我使用 RequestLogger,但我不知道如何检查 UI 字段之一是否具有预期值。
有什么想法吗?
我想检查该字段是否有标记值
最佳答案
这是一个示例:
const errorMsg = Selector('.alert.alert-error').innerText
await t.expect(errorMsg).contains("Login and/or password are wrong.")
另一种方法:
if(await Selector('div').withText('testee@tester.com').exists)
{
console.log("PASS")
}
else
{
console.log("FAIL")
}
关于javascript - TestCafe 如何检查字段值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59821997/