eg: debug window.screen
This commit is contained in:
parent
56cfab6e21
commit
7ca79bd413
1 changed files with 3 additions and 1 deletions
|
|
@ -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');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue