gpt4 book ai didi

css - 等待 testcafe 中的 css 属性值

转载 作者:行者123 更新时间:2023-11-28 20:03:39 25 4
gpt4 key购买 nike

我想等待某个元素在 CSS 属性中具有特定值。

更具体地说,我正在使用 Testcafe 进行一些功能测试,他们应该等到不透明度从 0 增加到 1。

最佳答案

为什么不使用标准 TestCafe Assertion机制?你可以写这样的东西

const opacity = await selector.getStyleProperty('opacity');
await t.expect(opacity).eql(1, {timeout: 5000})

超时选项通常在运行程序函数中设置,但可以为每个断言单独指定。一旦条件真实,它就会通过,否则 5 秒后就会失败。

关于css - 等待 testcafe 中的 css 属性值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51842681/

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