mirror of
https://github.com/vladocar/screenshoteer.git
synced 2024-11-17 01:18:32 +01:00
Add waitforselector
This commit is contained in:
parent
37d63d8816
commit
a33214dfe1
3 changed files with 7 additions and 2 deletions
|
@ -26,8 +26,10 @@ screenshoteer --url file:///C:/Users/../Random-HTML-file.html
|
||||||
<p>And with the help of puppeteer(Headless Chrome) it will generate screenshot of the entire web page.</p>
|
<p>And with the help of puppeteer(Headless Chrome) it will generate screenshot of the entire web page.</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Parameters:
|
Parameters:
|
||||||
|
|
||||||
|
|
||||||
|
-h help
|
||||||
--url web page url
|
--url web page url
|
||||||
--emulate - emulate web device example: --emulate "iPhone 6"
|
--emulate - emulate web device example: --emulate "iPhone 6"
|
||||||
--fullpage - can be true or false. It will take screenshot of entire web page if is true. True is the default parameter.
|
--fullpage - can be true or false. It will take screenshot of entire web page if is true. True is the default parameter.
|
||||||
|
@ -35,6 +37,7 @@ Parameters:
|
||||||
--w - width of the Web Page in px
|
--w - width of the Web Page in px
|
||||||
--h - height of the Web Page in px
|
--h - height of the Web Page in px
|
||||||
--waitfor - wait time for the page load in milliseconds
|
--waitfor - wait time for the page load in milliseconds
|
||||||
|
--waitforselector - wait for the selector to appear in page
|
||||||
--el - css selector document.querySelector
|
--el - css selector document.querySelector
|
||||||
--auth - basic http authentication
|
--auth - basic http authentication
|
||||||
--no - exclude "image", "stylesheet", "script", "font"
|
--no - exclude "image", "stylesheet", "script", "font"
|
||||||
|
|
2
index.js
2
index.js
|
@ -12,6 +12,7 @@ program
|
||||||
.option('--w, [w]', 'width')
|
.option('--w, [w]', 'width')
|
||||||
.option('--h, [h]', 'height')
|
.option('--h, [h]', 'height')
|
||||||
.option('--waitfor, [waitfor]', 'Wait time in milliseconds')
|
.option('--waitfor, [waitfor]', 'Wait time in milliseconds')
|
||||||
|
.option('--waitforselector, [waitforselector]', 'Wait for the selector to appear in page')
|
||||||
.option('--el, [el]', 'element css selector')
|
.option('--el, [el]', 'element css selector')
|
||||||
.option('--auth, [auth]', 'Basic HTTP authentication')
|
.option('--auth, [auth]', 'Basic HTTP authentication')
|
||||||
.option('--no, [no]', 'Exclude')
|
.option('--no, [no]', 'Exclude')
|
||||||
|
@ -69,6 +70,7 @@ console.log(program.fullPage);
|
||||||
await page.goto(program.url);
|
await page.goto(program.url);
|
||||||
const title = (await page.title()).replace(/[/\\?%*:|"<>]/g, '-');
|
const title = (await page.title()).replace(/[/\\?%*:|"<>]/g, '-');
|
||||||
if (program.waitfor) await page.waitFor(Number(program.waitfor));
|
if (program.waitfor) await page.waitFor(Number(program.waitfor));
|
||||||
|
if (program.waitforselector) await page.waitForSelector(program.waitforselector);
|
||||||
if (program.click) await page.click(program.click);
|
if (program.click) await page.click(program.click);
|
||||||
const file = program.file ? program.file : `${title} ${program.emulate} ${program.el} ${timestamp}.png`;
|
const file = program.file ? program.file : `${title} ${program.emulate} ${program.el} ${timestamp}.png`;
|
||||||
if (program.el) {
|
if (program.el) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "screenshoteer",
|
"name": "screenshoteer",
|
||||||
"version": "1.0.8",
|
"version": "1.0.9",
|
||||||
"description": "Make screenshots and device emulations form your terminal",
|
"description": "Make screenshots and device emulations form your terminal",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
Loading…
Reference in a new issue