gpt4 book ai didi

javascript - 排毒:仅在存在时点击按钮

转载 作者:行者123 更新时间:2023-11-28 19:53:07 25 4
gpt4 key购买 nike

在我的测试中,我想在“取消升级”按钮显示时模拟点击:

it('should be in home menu', async () => {
await waitFor(element(by.id('cancelUpgrade')))
.toBeVisible()
.withTimeout(2000);
await element(by.id('cancelUpgrade')).tap();
});

它返回预期的错误错误:找不到 UI 元素。

https://github.com/wix/detox

最佳答案

您可以将 tap 包装在 try/catch block 中:

it('should be in home menu', async () => {
await waitFor(element(by.id('cancelUpgrade')))
.toBeVisible()
.withTimeout(2000);
try {
await element(by.id('cancelUpgrade')).tap();
} catch (e) {}
// continue your tests
});

这不是最好的方法,但我认为这是目前排毒的可能方法。

关于javascript - 排毒:仅在存在时点击按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46550137/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com