Created
August 6, 2024 12:26
-
-
Save jimmont/d70845b0fc7e673b1676fb08dd70d025 to your computer and use it in GitHub Desktop.
browser ui testing, scraping, etc
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
// astral alternative to puppeteer and playwright, similar API | |
// run: deno run -A ./uitest.js | |
// more at https://github.com/lino-levan/astral | |
import { launch } from "jsr:@astral/astral"; | |
const browser = await launch({ | |
headless: true, | |
// note will attempt to auto-install... to use local options use the path value | |
// macos | |
// path: '/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome' | |
// debian: sudo apt install chromium-browser chromium-codecs-ffmpeg | |
// path: '/usr/lib/chromium-browser/chromium-browser' | |
}); | |
const page = await browser.newPage("https://deno.com"); | |
const screenshot = await page.screenshot(); | |
Deno.writeFileSync("screenshot.png", screenshot); | |
await browser.close(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment