我需要一个关于点击 testCafe 的非常简单的帮助。
我有一个简单的元素 10
我怎样才能做到这一点?
我需要一个关于点击 testCafe 的非常简单的帮助。
我有一个简单的元素 10
我怎样才能做到这一点?
使用nth(index)方法通过索引选择元素:
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
const ul = Selector('ul');
const li = ul.find('li');
const liCount = await li.count;
const index = getRandomInt(0, liCount);
await t.click(li.nth(index));