mirror of
https://github.com/vladocar/screenshoteer.git
synced 2024-11-16 17:08:33 +01:00
Add new waitfor parameter
This commit is contained in:
parent
0a9eba44e5
commit
59ba221c0b
3 changed files with 4 additions and 1 deletions
|
@ -28,6 +28,7 @@ Parameters:
|
|||
--pdf - generate additional pdf
|
||||
--w - width of the Web Page in px
|
||||
--h - height of the Web Page in px
|
||||
--waitfor - wait time for the page load in milliseconds
|
||||
|
||||
<p>
|
||||
|
||||
|
|
2
index.js
2
index.js
|
@ -13,6 +13,7 @@ program
|
|||
.option('--pdf, [pdf]', 'Generate PDF')
|
||||
.option('--w, [w]', 'width')
|
||||
.option('--h, [h]', 'height')
|
||||
.option('--waitfor, [waitfor]', 'Wait time in milliseconds')
|
||||
.parse(process.argv);
|
||||
|
||||
if (program.url) urlvalue = program.url
|
||||
|
@ -33,6 +34,7 @@ console.log(fullPage);
|
|||
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]);
|
||||
await page.goto(urlvalue)
|
||||
if (program.waitfor) await page.waitFor(Number(program.waitfor))
|
||||
await page.screenshot({path: await page.title() + " " + program.emulate + " " + d.getTime() + '.png', fullPage: fullPage})
|
||||
await page.emulateMedia('screen')
|
||||
if (program.pdf) await page.pdf({ path: await page.title() + " " + program.emulate + " " + d.getTime() + '.pdf' })
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "screenshoteer",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "Make screenshots and device emulations form your terminal",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
|
Loading…
Reference in a new issue