prime-gaming: click Games since now only placeholders until in view

This commit is contained in:
Ralf Vogler 2022-03-31 19:43:07 +02:00
parent f0bf3c1671
commit a707acf1b8

View file

@ -49,6 +49,7 @@ while (await page.locator('button:has-text("Sign in")').count() > 0) {
if (!debug) context.setDefaultTimeout(TIMEOUT); if (!debug) context.setDefaultTimeout(TIMEOUT);
} }
console.log('Signed in.'); console.log('Signed in.');
await page.click('button:has-text("Games")');
await page.waitForSelector('div[data-a-target="offer-list-FGWP_FULL"]'); await page.waitForSelector('div[data-a-target="offer-list-FGWP_FULL"]');
console.log('Number of already claimed games (total):', await page.locator('div[data-a-target="offer-list-FGWP_FULL"] p:has-text("Claimed")').count()); console.log('Number of already claimed games (total):', await page.locator('div[data-a-target="offer-list-FGWP_FULL"] p:has-text("Claimed")').count());
const game_sel = 'div[data-a-target="offer-list-FGWP_FULL"] .offer__action:has-text("Claim game")'; const game_sel = 'div[data-a-target="offer-list-FGWP_FULL"] .offer__action:has-text("Claim game")';
@ -74,7 +75,7 @@ for (const card of games) {
if (!card) break; if (!card) break;
const title = await (await card.$('h3')).innerText(); const title = await (await card.$('h3')).innerText();
console.log('Current free game:', title); console.log('Current free game:', title);
await (await card.$('button')).click(); await (await card.$('text=Claim')).click();
// await page.waitForNavigation(); // await page.waitForNavigation();
await page.click('button:has-text("Claim now")'); await page.click('button:has-text("Claim now")');
// TODO only Origin shows a key, check for 'Claimed' or code // TODO only Origin shows a key, check for 'Claimed' or code