How to take a screenshot with Playwright?
You can take a screenshot with Playwright via the
screenshot method of the
Page object. You can optionally pass in the
full_page boolean argument to the
screenshot method to save the screenshot of the whole page.
Here is some sample code that navigates to ScrapingBee's homepage and saves the screenshot in a
from playwright.sync_api import sync_playwright with sync_playwright() as p: browser = p.chromium.launch(headless = False) page = browser.new_page() page.goto("https://scrapingbee.com") # Save the screenshot page.screenshot(path="screenshot.png")