Is it possible to take a screenshot by passing coordinates and dimensions (like the output of getBoundingClientRect() ) via Playwright ?
Looking at their screenshots API , it seems I need to select a locator first, but the locator API doesn't seem to accept coordinates as arguments.
await page.locator('.header').screenshot({ path: 'screenshot.png' });
I believe the ability to screenshot specific co-ordinates are only available at page level by passing in the PageScreenshotOptions as an option:
await page.screenshot({ clip: {height: 100, width: 100, x: 0, y: 0 } });
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.