Skip to content

Instantly share code, notes, and snippets.

@mjzone
Created May 21, 2024 08:27
Show Gist options
  • Save mjzone/e4fa0d095ef144f8cd9e5f8b61a9780d to your computer and use it in GitHub Desktop.
Save mjzone/e4fa0d095ef144f8cd9e5f8b61a9780d to your computer and use it in GitHub Desktop.
const puppeteer = require("puppeteer");
(async () => {
console.log("starting....");
const browser = await puppeteer.launch({
headless: true,
args: ["--no-sandbox"],
});
const page = await browser.newPage();
try {
// Navigating to the Enlear Academy blog
await page.goto("https://enlear.academy", { waitUntil: "load", timeout: 20000 });
// Take a screenshot
const screenshotPath = "enlear.jpeg";
await page.screenshot({ path: screenshotPath, fullPage: true });
console.log("Puppeteer script executed successfully.");
// Upload the screenshot to S3
// await uploadToS3(screenshotPath);
} catch (error) {
console.error("Error running Puppeteer script:", error);
} finally {
// Close the browser
await browser.close();
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment