Created
May 23, 2018 14:29
-
-
Save rwinscot/81a078296ac9e62bd1be6c2428564675 to your computer and use it in GitHub Desktop.
Screenshot HTTP 404 ( not found )
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // NodeJS v8.11.1 | |
| // Puppeteer v1.4.0 | |
| // https://github.com/GoogleChrome/puppeteer/tree/v1.4.0 | |
| const browser = await puppeteer.launch(); | |
| const page = await browser.newPage(); | |
| page.on('console', msg => { | |
| if (msg.type() == 'error' && msg.text().indexOf('404') >= 0) { | |
| page.screenshot({path: './screenshot.png'}); | |
| } | |
| }); | |
| await page.goto('http://www.google.com/page_does_not_exist.html', {waitUntil: 'networkidle2'}); | |
| await browser.close(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment