【发布时间】:2019-02-22 18:00:45
【问题描述】:
我是 WebPagetest (https://www.webpagetest.org/) 的新手,在登录表单时遇到了一些问题。我正在使用脚本,并且可以导航到带有表单的页面,但似乎我没有正确输入任何表单值,也没有提交表单。
这是我的脚本的一个版本:
logData 1
navigate https://www.example.com/secure/login
setValue name=username activation_test
setValue name=password password
submitForm id=signInForm
//clickAndWait id=signInBtn
//exec document.getElementsByTagName('html')[0].style.display = 'none';
sleep 5
block google.com/csi
navigate https://www.example.com/?jbhp=true
当然,我的第一个想法是确保我的 HTML 元素匹配,但它们看起来没问题...
- 用户名:
input tabindex="1" aria-required="true" class="success required" id="username" maxlength="64" name="username" placeholder="Email Address or用户名" type="text" value=""
- 密码:
input tabindex="2" aria-required="true" class="success required" id="password" name="password" placeholder="Password" type="password" 值=""
- 表格:
form action="#" id="signInForm" method="post" class="form formLarge" novalidate="novalidate"
- 提交(在表单中验证;仅在 clickAndWait 未注释时使用):
button tabindex="3" id="signInBtn" class="ancBtn lrg" data-track-click="sign in : sign in" type="submit"
测试的结果页面显示它导航到最终位置,就像没有登录一样。另外,我认为这是结果的一部分:Step_2 (错误:导航错误)。遗憾的是,如果有更好的文档说明具体导致导航错误的原因,我还没有找到。
最后,如果我从使用“submitForm”切换到“clickAndWait”(在上面的示例中已被注释掉),结果的唯一区别是 Step_2 显示的是页面的屏幕截图,而不仅仅是一个橙色块。
【问题讨论】:
标签: testing automated-tests synthetic webpagetest