Despite my attempts to send it to the browser console by using .pressKey("PageDown")
after tracking it, nothing seems to be happening. I'm at a loss on what steps to take next - perhaps there are some examples available? I was advised to utilize the clientfunction
, but I'm struggling to put everything together without any concrete examples to guide me. Below is the code I've tried:
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");
});
});