mirror of
https://github.com/vladocar/screenshoteer.git
synced 2024-11-16 17:08:33 +01:00
fix path when no emulate
This commit is contained in:
parent
920236282b
commit
ce7ebb00e0
1 changed files with 5 additions and 2 deletions
7
index.js
7
index.js
|
@ -4,7 +4,7 @@ const puppeteer = require('puppeteer')
|
||||||
const devices = require('puppeteer/DeviceDescriptors')
|
const devices = require('puppeteer/DeviceDescriptors')
|
||||||
const program = require('commander')
|
const program = require('commander')
|
||||||
|
|
||||||
var urlvalue, emulate = "";
|
let urlvalue;
|
||||||
|
|
||||||
program
|
program
|
||||||
.option('--url, [url]', 'The url')
|
.option('--url, [url]', 'The url')
|
||||||
|
@ -40,7 +40,10 @@ console.log(fullPage);
|
||||||
const page = await browser.newPage()
|
const page = await browser.newPage()
|
||||||
const timestamp = new Date().getTime()
|
const timestamp = new Date().getTime()
|
||||||
if (program.w && program.h) await page.setViewport({width: Number(program.w), height: Number(program.h)})
|
if (program.w && program.h) await page.setViewport({width: Number(program.w), height: Number(program.h)})
|
||||||
if (program.emulate) await page.emulate(devices[program.emulate]);
|
if (program.emulate)
|
||||||
|
await page.emulate(devices[program.emulate]);
|
||||||
|
else
|
||||||
|
program.emulate = '';
|
||||||
if (program.auth) {
|
if (program.auth) {
|
||||||
const [username, password] = program.auth.split(';');
|
const [username, password] = program.auth.split(';');
|
||||||
await page.authenticate({username:username, password:password});
|
await page.authenticate({username:username, password:password});
|
||||||
|
|
Loading…
Reference in a new issue