testcafe/node.js元素查询中引发错误



我在编写的testcafe脚本中有以下代码片段。

32: let NNT = Selector('#notNow').withText('No thanks, not at this time.')
33: button = Selector('.myclass')
34: let email = Vladimir.Putin@gmail.com
35: await t.click(button)
36: let emailS= Selector('#login-email')
37: await t.expect(emailS.visible).ok()
38: await t.debug()
39: await t.typeText(emailS,email)

但是在第 38 行,我收到以下错误

页面上的错误"https://mywebpage.com":

未捕获的类型错误:无法读取未定义的属性"top">

我意识到此错误意味着我的页面不再存在,但是肯定有一个电子邮件框,这里是html

<li>
<label for="login-email">Email Address</label>
<div class="input-box">
<input type="text" class="input-text required-entry validate-email" id="login-email" name="login[username]" value="">
</div>
</li>

那么在这种情况下,此错误意味着什么。 提前谢谢。

更新:在删除行以查看错误发生的位置时,我发现错误在加载包含 .myclass 的页面后立即抛出。

此属性"top"在哪里被引用? 在这种情况下,这意味着无论您期望属性"top"存在于哪个对象中,该对象都不存在,因此它是未定义的

这是网站有一些不好的引用的问题,这些引用没有影响网站,但testcafe仍然因此而失败。 我用标志 -e 运行它。 然后代码就可以工作了。

最新更新