Created
May 21, 2024 08:27
-
-
Save mjzone/e4fa0d095ef144f8cd9e5f8b61a9780d to your computer and use it in GitHub Desktop.
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
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