From fd56cac06b754331b5ac58eece69a2646bcb8984 Mon Sep 17 00:00:00 2001 From: Ralf Vogler Date: Thu, 31 Mar 2022 19:55:19 +0200 Subject: [PATCH] prime-gaming: only print code to redeem game for Origin --- prime-gaming.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/prime-gaming.js b/prime-gaming.js index 13677ef..4e0dce0 100644 --- a/prime-gaming.js +++ b/prime-gaming.js @@ -78,9 +78,12 @@ for (const card of games) { await (await card.$('text=Claim')).click(); // await page.waitForNavigation(); 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 - const code = await page.inputValue('input[type="text"]'); - console.log('Code to redeem game:', code); + if (await page.locator('div:has-text("Origin")').count() > 0) { + const code = await page.inputValue('input[type="text"]'); + console.log('Code to redeem game:', code); + } // await page.pause(); await page.goto(URL_CLAIM, {waitUntil: 'domcontentloaded'}); n = await page.locator(game_sel).count();