12 allow for just width or height. If height, fix fullPage

This commit is contained in:
vid 2018-12-08 00:37:10 -08:00
parent a0e425353a
commit ebc6c4234f
1 changed files with 6 additions and 1 deletions

View File

@ -38,7 +38,12 @@ 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)})
if (program.w || program.h) {
const newWidth = !program.w?600:program.w
const newHeight = !program.h?'0':program.h
if (program.h && !program.fullpage) fullPage = false;
await page.setViewport({width: Number(newWidth), height: Number(newHeight)})
}
if (program.emulate) await page.emulate(devices[program.emulate]);
await page.goto(urlvalue)
const title = await page.title()