-
-
Save eugeniosegala/d3f44fd302fdc8b6b086ab462df9054d to your computer and use it in GitHub Desktop.
initial settings puppeteer
This file contains 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
// IIFE | |
(async () => { | |
// wrapper to catch errors | |
try { | |
// create a new browser instance | |
const browser = await puppeteer.launch(); | |
// create a page inside the browser; | |
const page = await browser.newPage(); | |
// navigate to a website and set the viewport | |
await page.setViewport({ width: 1280, height: 800 }); | |
await page.goto(domain, { | |
timeout: 3000000 | |
}); | |
} catch (error) { | |
// display errors | |
console.log(error) | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment