Update prime-gaming.js

account for more than one account link button
This commit is contained in:
Jannis Hell 2023-12-23 11:55:27 +01:00 committed by GitHub
parent e06ad3a27f
commit 093ed813c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -349,12 +349,12 @@ try {
await page.goto(url, { waitUntil: 'domcontentloaded' }); await page.goto(url, { waitUntil: 'domcontentloaded' });
// most games have a button 'Get in-game content' // most games have a button 'Get in-game content'
// epic-games: Fall Guys: Claim -> Continue -> Go to Epic Games (despite account linked and logged into epic-games) -> not tied to account but via some cookie? // epic-games: Fall Guys: Claim -> Continue -> Go to Epic Games (despite account linked and logged into epic-games) -> not tied to account but via some cookie?
await Promise.any([page.click('button:has-text("Get in-game content")'), page.click('button:has-text("Claim your gift")'), page.click('button:has-text("Claim")').then(() => page.click('button:has-text("Continue")'))]); await Promise.any([page.click('.tw-button:has-text("Get in-game content")'), page.click('.tw-button:has-text("Claim your gift")'), page.click('.tw-button:has-text("Claim")').then(() => page.click('button:has-text("Continue")'))]);
page.click('button:has-text("Continue")').catch(_ => { }); page.click('button:has-text("Continue")').catch(_ => { });
const linkAccountButton = page.locator('[data-a-target="LinkAccountButton"]'); const linkAccountButton = page.locator('[data-a-target="LinkAccountButton"]');
let unlinked_store; let unlinked_store;
if (await linkAccountButton.count()) { if (await linkAccountButton.count()) {
unlinked_store = await linkAccountButton.getAttribute('aria-label'); unlinked_store = await linkAccountButton.first().getAttribute('aria-label');
console.debug(' LinkAccountButton label:', unlinked_store); console.debug(' LinkAccountButton label:', unlinked_store);
const match = unlinked_store.match(/Link (.*) account/); const match = unlinked_store.match(/Link (.*) account/);
if (match && match.length == 2) unlinked_store = match[1]; if (match && match.length == 2) unlinked_store = match[1];