From a7cc68b6db41a9542684099583c9127a9b703fa9 Mon Sep 17 00:00:00 2001 From: Ralf Vogler Date: Thu, 9 Nov 2023 01:41:01 +0100 Subject: [PATCH] ue: login: fix #248, similar to #236 Commits for #236: https://github.com/vogler/free-games-claimer/commit/d73a523fe7f76608af5db4e72b567f058814fea1 https://github.com/vogler/free-games-claimer/commit/a374d483451f1fa19c0f9f461e32cb37a4b46fd7 --- unrealengine.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/unrealengine.js b/unrealengine.js index 5bbf988..cd2eb33 100644 --- a/unrealengine.js +++ b/unrealengine.js @@ -48,7 +48,7 @@ try { await page.waitForResponse(r => r.request().method() == 'POST' && r.url().startsWith('https://graphql.unrealengine.com/ue/graphql')); - while (await page.locator('.display-name').count() == 0) { + while (await page.locator('unrealengine-navigation').getAttribute('isloggedin') != 'true') { console.error('Not signed in anymore. Please login in the browser or here in the terminal.'); if (cfg.novnc_port) console.info(`Open http://localhost:${cfg.novnc_port} to login inside the docker container.`); if (!cfg.debug) context.setDefaultTimeout(cfg.login_timeout); // give user some extra time to log in @@ -59,8 +59,9 @@ try { const email = cfg.eg_email || await prompt({ message: 'Enter email' }); const password = email && (cfg.eg_password || await prompt({ type: 'password', message: 'Enter password' })); if (email && password) { - await page.click('text=Sign in with Epic Games'); + // await page.click('text=Sign in with Epic Games'); await page.fill('#email', email); + await page.click('button[type="submit"]'); await page.fill('#password', password); await page.click('button[type="submit"]'); page.waitForSelector('#h_captcha_challenge_login_prod iframe').then(() => { @@ -88,7 +89,7 @@ try { if (!cfg.debug) context.setDefaultTimeout(cfg.timeout); } await page.waitForTimeout(1000); - user = await page.locator('.display-name').first().innerHTML(); + user = await page.locator('unrealengine-navigation').getAttribute('displayname'); // 'null' if !isloggedin console.log(`Signed in as ${user}`); db.data[user] ||= {};