diff --git a/README.md b/README.md index 3d8b162..1164301 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,10 @@ screenshoteer --url file:///C:/Users/../Random-HTML-file.html
And with the help of puppeteer(Headless Chrome) it will generate screenshot of the entire web page.
-Parameters: +Parameters: + +-h help --url web page url --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. @@ -35,6 +37,7 @@ Parameters: --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 +--waitforselector - wait for the selector to appear in page --el - css selector document.querySelector --auth - basic http authentication --no - exclude "image", "stylesheet", "script", "font" diff --git a/index.js b/index.js index b8f3d60..f20fab9 100755 --- a/index.js +++ b/index.js @@ -12,6 +12,7 @@ program .option('--w, [w]', 'width') .option('--h, [h]', 'height') .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('--auth, [auth]', 'Basic HTTP authentication') .option('--no, [no]', 'Exclude') @@ -69,6 +70,7 @@ console.log(program.fullPage); await page.goto(program.url); const title = (await page.title()).replace(/[/\\?%*:|"<>]/g, '-'); 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); const file = program.file ? program.file : `${title} ${program.emulate} ${program.el} ${timestamp}.png`; if (program.el) { diff --git a/package.json b/package.json index 813338b..104d966 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "screenshoteer", - "version": "1.0.8", + "version": "1.0.9", "description": "Make screenshots and device emulations form your terminal", "main": "index.js", "scripts": {