在我的 testcafe 测试中,我有一个匹配多个节点的选择器。我想在此选择器匹配的所有节点上执行断言。
这将仅对返回的第一个元素执行断言mySelector
await t.expect(mySelector.innerText).eql("foo");
这将在所有元素上执行它,但它真的很冗长:
const count= await mySelector.count;
for (let i = 0; i < count; ++i) {
await t.expect(mySelector.nth(i).innerText).eql("foo");
}
有没有一种我缺少的内置方法可以做到这一点?