You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've noticed that if I run the command with just width and no height, width is ignored.
From line 41: if (program.w && program.h) await page.setViewport({width: Number(program.w), height: Number(program.h)})
If I run it with a specified width, and height 0, I do get the specified width.
So the user can get around this but a nice addition might be to set h to 0 if it's unset.
Maybe something like this
diff --git a/index.js b/index.js
index 40f5b02..cb7b821 100755
--- a/index.js
+++ b/index.js
@@ -38,7 +38,8 @@ console.log(fullPage);
const browser = await puppeteer.launch()
const page = await browser.newPage()
const d = new Date()
- if (program.w && program.h) await page.setViewport({width: Number(program.w), height: Number(program.h)})
+ const height = !program.h?0:program.h;
+ if (program.w && height) await page.setViewport({width: Number(program.w), height: Number(height)})
if (program.emulate) await page.emulate(devices[program.emulate]);
await page.goto(urlvalue)
const title = await page.title()
The text was updated successfully, but these errors were encountered:
Sure. Since the default is fullpage=true; I want to specify a width and get a screenshot with my width and full page.
Right now I only achieve this with --h 0 --h 0 is a work around, it's used so that the code respects the --w arg.
I've noticed that if I run the command with just width and no height, width is ignored.
From line 41:
if (program.w && program.h) await page.setViewport({width: Number(program.w), height: Number(program.h)})
If I run it with a specified width, and height 0, I do get the specified width.
So the user can get around this but a nice addition might be to set h to 0 if it's unset.
Maybe something like this
The text was updated successfully, but these errors were encountered: