TestCafe - fixture.beforeEach 挂钩错误

TestCafe - Error in fixture.beforeEach hook

我正在使用 Testcafe 对应用程序进行端到端测试。对于我的一个固定装置,我使用的是 beforeEach。我的选择器在点击页面上的元素之前等待元素出现。有时这个测试通过,有时这个测试失败。很不协调。

代码:

fixture`Ingredient Details [En]`   
    .page`${url}en/something`   
    .beforeEach(async t => {              
        await t   
          .click(button1)   
          .wait(1000)
    })

我遇到的错误:

1) - Error in fixture.beforeEach hook -
      The specified selector does not match any element in the DOM tree.   

> | Selector('#accept-button')

似乎存在某种时间问题,有时它没有正确等待?

谢谢。

Testcafe 提供了一种调试方法 t.debug(),可以停止测试并允许您使用浏览器的开发人员工具调试问题。也许通过这样做,您可以在您尝试单击按钮时检查元素是否已加载。

更多信息:https://devexpress.github.io/testcafe/documentation/test-api/debugging.html#client-side-debugging