prime-gaming: only print code to redeem game for Origin

This commit is contained in:
Ralf Vogler 2022-03-31 19:55:19 +02:00
parent a707acf1b8
commit fd56cac06b

View file

@ -78,9 +78,12 @@ for (const card of games) {
await (await card.$('text=Claim')).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")');
console.log(await (await page.$('[data-a-target="hero-header-subtitle"]')).innerText());
// TODO only Origin shows a key, check for 'Claimed' or code // TODO only Origin shows a key, check for 'Claimed' or code
if (await page.locator('div:has-text("Origin")').count() > 0) {
const code = await page.inputValue('input[type="text"]'); const code = await page.inputValue('input[type="text"]');
console.log('Code to redeem game:', code); console.log('Code to redeem game:', code);
}
// await page.pause(); // await page.pause();
await page.goto(URL_CLAIM, {waitUntil: 'domcontentloaded'}); await page.goto(URL_CLAIM, {waitUntil: 'domcontentloaded'});
n = await page.locator(game_sel).count(); n = await page.locator(game_sel).count();