如何使用TestCafe选择是否选择复选框?
import { Selector } from 'testcafe';
fixture("TestCafe Example")
.page("http://devexpress.github.io/testcafe/example");
test("Fill out and submit form", async t => {
await t.typeText("#developer-name", "Harun Jonuzi");
//I Want to verify if these Checkboxes are Selected
await t
.click("#remote-testing")
.click("#reusing-js-code")
.click("#background-parallel-testing");
await t.click("#macos");
const preferredInterface = Selector("#preferred-interface");
await t
.click(preferredInterface)
.click(preferredInterface.find("option").withText("JavaScript API"));
const submitButton = Selector("#submit-button");
await t
.expect(submitButton.hasAttribute("disabled")).notOk();
await t.click(submitButton);
const headerInfo = Selector("#article-header");
await t.expect(headerInfo.innerText).eql("Thank you, Harun Jonuzi!");
})
我可以看到我的问题在代码的第六行上发表评论。 我正在努力弄清楚如何添加断言以验证复选框实际上检查了,但是我是TestCafe的新手,只是想看看我是否可以从这里获得一些帮助。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
检查
,例如:You can use the
checked
property of the DOMNodeState Object, for example: