Skip to content

Instantly share code, notes, and snippets.

View naramdash's full-sized avatar
🚲
Keep Studying & Working

김주호 naramdash

🚲
Keep Studying & Working
View GitHub Profile
@naramdash
naramdash / screenshot_cropped.spec.ts
Created December 22, 2024 08:57
take cropped screenshot with playwright
import { test, expect } from "@playwright/test";
import { writeFileSync } from "node:fs";
import sharp from "sharp";
test("take shots", async ({ page }) => {
await page.goto("https://playwright.dev/");
const imageBuffer = await page.screenshot();
const base = sharp(imageBuffer)
.extract({