eg: #483: also can't solve captcha with OpenGL working

This commit is contained in:
Ralf Vogler 2025-05-29 16:26:02 +02:00
parent 0f72aec108
commit d7956ee437

View file

@ -30,6 +30,7 @@ const context = await chromium.launchPersistentContext(cfg.dir.browser, {
// https://peter.sh/experiments/chromium-command-line-switches/ // https://peter.sh/experiments/chromium-command-line-switches/
args: [ args: [
'--hide-crash-restore-bubble', '--hide-crash-restore-bubble',
'--ignore-gpu-blocklist',
], ],
// The following makes the browser crash in docker with 'Chromium sandboxing failed!': // The following makes the browser crash in docker with 'Chromium sandboxing failed!':
// chromiumSandbox: true, // https://github.com/Kaliiiiiiiiii-Vinyzu/patchright/issues/52 // chromiumSandbox: true, // https://github.com/Kaliiiiiiiiii-Vinyzu/patchright/issues/52
@ -43,7 +44,7 @@ handleSIGINT(context);
if (!cfg.debug) context.setDefaultTimeout(cfg.timeout); if (!cfg.debug) context.setDefaultTimeout(cfg.timeout);
const page = context.pages().length ? context.pages()[0] : await context.newPage(); // should always exist 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 // 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) // some debug info about the page (screen dimensions, user agent, platform)
if (cfg.debug) console.debug(await page.evaluate(() => [(({ width, height, availWidth, availHeight }) => ({ width, height, availWidth, availHeight }))(window.screen), navigator.userAgent, navigator.platform, navigator.vendor])); // deconstruct screen needed since `window.screen` prints {}, `window.screen.toString()` '[object Screen]', and can't use some pick function without defining it on `page` if (cfg.debug) console.debug(await page.evaluate(() => [(({ width, height, availWidth, availHeight }) => ({ width, height, availWidth, availHeight }))(window.screen), navigator.userAgent, navigator.platform, navigator.vendor])); // deconstruct screen needed since `window.screen` prints {}, `window.screen.toString()` '[object Screen]', and can't use some pick function without defining it on `page`