From 944cca671564bcd859d6a07ac421c03f6628b741 Mon Sep 17 00:00:00 2001 From: Ralf Vogler Date: Fri, 24 Feb 2023 20:56:25 +0100 Subject: [PATCH] eg: add click delay, fixes #75 Playwright triggered the click such that the purchase frame opened, but did not resolve the promise. Had to move mouse into the browser for it to continue. Adding a click delay of 1ms also worked (default is no delay between mouse down and up). Went for 11ms. A typical click is probably 100-200ms. --- epic-games.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epic-games.js b/epic-games.js index a0a15dd..c25f88a 100644 --- a/epic-games.js +++ b/epic-games.js @@ -133,7 +133,7 @@ try { if (db.data[user][game_id].status == 'failed') db.data[user][game_id].status = 'manual'; // was failed but now it's claimed } else { // GET console.log(' Not in library yet! Click GET.'); - await page.click('[data-testid="purchase-cta-button"]'); + await page.click('[data-testid="purchase-cta-button"]', { delay: 11 }); // got stuck here without delay (or mouse move), see #75, 1ms was also enough // click Continue if 'Device not supported. This product is not compatible with your current device.' - avoided by Windows userAgent? page.click('button:has-text("Continue")').catch(_ => { }); // needed since change from Chromium to Firefox?