4

我正在编写的 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 ”上的错误:

未捕获的类型错误:无法读取未定义的属性“顶部”

我意识到这个错误意味着我的页面不再存在但是肯定有一个电子邮件框这里是 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 的页面后立即引发错误。

4

2 回答 2

3

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

于 2018-05-21T19:20:24.093 回答
2

这就是网站有一些错误的引用的问题,这些引用并没有影响到网站,但 testcafe 仍然因为它们而失败。我用标志-e运行它。然后代码工作。

于 2018-05-22T12:43:04.963 回答