From c3657f05ac6440563b5bf82cd3db37941d8bf1b5 Mon Sep 17 00:00:00 2001 From: Ralf Vogler Date: Thu, 28 Dec 2023 17:56:09 +0100 Subject: [PATCH] workaround for cropped viewport (Playwright regression), fixes #277 --- epic-games.js | 1 + gog.js | 1 + prime-gaming.js | 1 + unrealengine.js | 1 + xbox.js | 1 + 5 files changed, 5 insertions(+) diff --git a/epic-games.js b/epic-games.js index 2644c40..55d9ad7 100644 --- a/epic-games.js +++ b/epic-games.js @@ -41,6 +41,7 @@ await stealth(context); if (!cfg.debug) context.setDefaultTimeout(cfg.timeout); const page = context.pages().length ? context.pages()[0] : await context.newPage(); // should always exist +await page.setViewportSize({ width: cfg.width, height: cfg.height }); // TODO workaround for https://github.com/vogler/free-games-claimer/issues/277 until Playwright fixes it // some debug info about the page (screen dimensions, user agent, platform) // eslint-disable-next-line no-undef diff --git a/gog.js b/gog.js index 048e04a..651afa6 100644 --- a/gog.js +++ b/gog.js @@ -25,6 +25,7 @@ handleSIGINT(context); if (!cfg.debug) context.setDefaultTimeout(cfg.timeout); const page = context.pages().length ? context.pages()[0] : await context.newPage(); // should always exist +await page.setViewportSize({ width: cfg.width, height: cfg.height }); // TODO workaround for https://github.com/vogler/free-games-claimer/issues/277 until Playwright fixes it // console.debug('userAgent:', await page.evaluate(() => navigator.userAgent)); const notify_games = []; diff --git a/prime-gaming.js b/prime-gaming.js index 7b7f18b..3868274 100644 --- a/prime-gaming.js +++ b/prime-gaming.js @@ -31,6 +31,7 @@ await stealth(context); if (!cfg.debug) context.setDefaultTimeout(cfg.timeout); const page = context.pages().length ? context.pages()[0] : await context.newPage(); // should always exist +await page.setViewportSize({ width: cfg.width, height: cfg.height }); // TODO workaround for https://github.com/vogler/free-games-claimer/issues/277 until Playwright fixes it // console.debug('userAgent:', await page.evaluate(() => navigator.userAgent)); const notify_games = []; diff --git a/unrealengine.js b/unrealengine.js index bfd3417..e67633e 100644 --- a/unrealengine.js +++ b/unrealengine.js @@ -36,6 +36,7 @@ await stealth(context); if (!cfg.debug) context.setDefaultTimeout(cfg.timeout); const page = context.pages().length ? context.pages()[0] : await context.newPage(); // should always exist +await page.setViewportSize({ width: cfg.width, height: cfg.height }); // TODO workaround for https://github.com/vogler/free-games-claimer/issues/277 until Playwright fixes it // console.debug('userAgent:', await page.evaluate(() => navigator.userAgent)); const notify_games = []; diff --git a/xbox.js b/xbox.js index 008388c..b2406cc 100644 --- a/xbox.js +++ b/xbox.js @@ -32,6 +32,7 @@ if (!cfg.debug) context.setDefaultTimeout(cfg.timeout); const page = context.pages().length ? context.pages()[0] : await context.newPage(); // should always exist +await page.setViewportSize({ width: cfg.width, height: cfg.height }); // TODO workaround for https://github.com/vogler/free-games-claimer/issues/277 until Playwright fixes it const notify_games = []; let user;