I tried to send it to the browser console by pressing .pressKey("PageDown")
, after tracking it, but nothing came of it. Who can tell what steps to take next, maybe there are examples? I was told that you can use the clientfunction
, but I can’t understand how to put it all together due to the lack of the same examples. The attempted code is below:
await t
.click(S(sCounter))
.pressKey("PageDown");
await t.eval(() => {
document.addEventListener("keydown", function (event) {
console.log(event.key);
if (event.key === "PageDown") {
console.log("PageDown press");
let isKeyPressed = false;
let timeoutId: ReturnType<typeof setTimeout> | null = null;
isKeyPressed = true;
timeoutId = setTimeout(() => {
isKeyPressed = false;
if (timeoutId !== null) {
clearTimeout(timeoutId);
}
}, 10 * 1000); // set the timeout to the specified number of seconds
}
console.log("PageDown Up");
});
});