我正在编写的 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 的页面后立即引发错误。