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.
This commit is contained in:
Ralf Vogler 2023-02-24 20:56:25 +01:00
parent 0d2ff0c8a9
commit 944cca6715

View file

@ -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 if (db.data[user][game_id].status == 'failed') db.data[user][game_id].status = 'manual'; // was failed but now it's claimed
} else { // GET } else { // GET
console.log(' Not in library yet! Click 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? // 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? page.click('button:has-text("Continue")').catch(_ => { }); // needed since change from Chromium to Firefox?