diff --git a/prime-gaming.js b/prime-gaming.js index 663c987..e957a8b 100644 --- a/prime-gaming.js +++ b/prime-gaming.js @@ -163,10 +163,10 @@ try { if (cfg.pg_timeLeft && await skipBasedOnTime(url)) continue; if (cfg.dryrun) continue; if (cfg.interactive && !await confirm()) continue; - await (await card.$('.tw-button:has-text("Claim")')).click(); + await card.locator('.tw-button:has-text("Claim")').click(); db.data[user][title] ||= { title, time: datetime(), url, store: 'internal' }; notify_games.push({ title, status: 'claimed', url }); - // const img = await (await card.$('img.tw-image')).getAttribute('src'); + // const img = await card.locator('img.tw-image').getAttribute('src'); // console.log('Image:', img); await card.screenshot({ path: screenshot('internal', `${filenamify(title)}.png`) }); } @@ -219,7 +219,7 @@ try { const code = await Promise.any([page.inputValue('input[type="text"]'), page.textContent('[data-a-target="ClaimStateClaimCodeContent"]').then(s => s.replace('Your code: ', ''))]); // input: Legacy Games; text: gog.com console.log(' Code to redeem game:', chalk.blue(code)); if (store == 'legacy games') { // may be different URL like https://legacygames.com/primeday/puzzleoftheyear/ - redeem[store] = await (await page.$('li:has-text("Click here") a')).getAttribute('href'); // full text: Click here to enter your redemption code. + redeem[store] = await page.locator('li:has-text("Click here") a').getAttribute('href'); // full text: Click here to enter your redemption code. } let redeem_url = redeem[store]; if (store == 'gog.com') redeem_url += '/' + code; // to log and notify, but can't use for goto below (captcha)