eg: debug window.screen

This commit is contained in:
Ralf Vogler 2023-12-28 17:31:18 +01:00
parent 56cfab6e21
commit 7ca79bd413

View file

@ -41,8 +41,10 @@ await stealth(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
// some debug info about the page (screen dimensions, user agent, platform)
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
if (cfg.debug) console.debug(await page.evaluate(() => [window.screen, navigator.userAgent, navigator.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_network) { if (cfg.debug_network) {
// const filter = _ => true; // const filter = _ => true;
const filter = r => r.url().includes('store.epicgames.com'); const filter = r => r.url().includes('store.epicgames.com');