Skip to content

Instantly share code, notes, and snippets.

@eugeniosegala
Created April 10, 2019 16:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eugeniosegala/d3f44fd302fdc8b6b086ab462df9054d to your computer and use it in GitHub Desktop.
Save eugeniosegala/d3f44fd302fdc8b6b086ab462df9054d to your computer and use it in GitHub Desktop.
initial settings puppeteer
// 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