I need a very simple help about click on testCafe.
I' ve got a simple element with 10
How can I do this?
I need a very simple help about click on testCafe.
I' ve got a simple element with 10
How can I do this?
Use the nth(index) method to select an element by its 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));