问题描述
我正在尝试使用 selenium webdriver 为 http://automationpractice.com/index.php?controller=authentication&back=my-account 编写自动化脚本并使用 jest 运行测试
我将创建帐户按钮定义为,
get createAccountBtn() {
return $("#SubmitCreate");
}
这里使用的是,
createAcctBtnIsVisible() {
this.createAccountBtn.waitForExist();
}
在我的测试中,我用它来断言按钮是可见的,如下所示:
test("it loads the create account button",async () => {
expect(authPageForms.createAcctBtnIsVisible).tobedefined();
});
通过了。
我也有一个使用这个选择器的函数,然后点击创建帐户按钮并像这样定义它,
submitNewEmail() {
this.createAccountBtn.waitForExist();
this.createAccountBtn.click();
}
在我的测试中,这是它正在执行的断言
test("it does not allow the user to continue without entering a valid email address",async () => {
authPageForms.submitNewEmail();
expect(errorMsg).toBe("Invalid email address.");
});
ReferenceError: $ is not defined
9 |
10 | get createAccountBtn() {
> 11 | return $("#SubmitCreate");
| ^
12 | }
我不确定为什么会发生这种情况。感谢您的帮助。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)