Skip to content

Instantly share code, notes, and snippets.

@johnlindquist
Created December 20, 2023 18:17
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 johnlindquist/112a6106d606c95435e8694637cc7ecb to your computer and use it in GitHub Desktop.
Save johnlindquist/112a6106d606c95435e8694637cc7ecb to your computer and use it in GitHub Desktop.
import "@johnlindquist/kit"
import { chromium } from "playwright"
let browser = await chromium.launch({
headless: false, // Set to true if you do not need to see the browser
})
let page = await browser.newPage()
await page.setViewportSize({ width: 1920, height: 1080 })
await page.goto("https://scriptkit.com")
// Wait for the network to be idle before taking the screenshot
await page.waitForLoadState("networkidle")
let screenshotPath = home(`scriptkit-${Date.now()}.png`)
await page.screenshot({ path: screenshotPath })
await browser.close()
await revealFile(screenshotPath)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment