Skip to content

playwright

67,537 22 699 Apache-2.0
1.49.0 (7 Dec 2024) Jan 23 2015 45.3 million (month)

Playwright is a Node.js library that provides a high-level API to automate web browsers. It allows you to automate browser tasks such as generating screenshots, creating PDFs, and testing web pages by simulating user interactions. Playwright is similar to Puppeteer, but it supports more browsers and it also provide capabilities for automation of browser like Microsoft Edge and Safari.

Playwright is commonly used for web scraping, end-to-end testing, and browser automation.
Playwright is a spiritual successor to Puppeter and is available in more languages and has access to more browser types.

Example Use


const { chromium } = require('playwright');

(async () => {
    const browser = await chromium.launch();
    const context = await browser.newContext();
    const page = await context.newPage();
    await page.goto('https://www.example.com/form');

    // fill in the form
    await page.fill('input[name="name"]', 'John Doe');
    await page.fill('input[name="email"]', 'johndoe@example.com');
    await page.selectOption('select[name="country"]', 'US');

    // submit the form
    await page.click('button[type="submit"]');

    // wait for the page to load after the form is submitted
    await page.waitForNavigation();

    // take a screenshot
    await page.screenshot({path: 'form-submission.png'});

    await browser.close();
})();

Alternatives / Similar


Other Languages

12,005 1.49.0 (18 days ago) Feb 24 2021 compare
30,908 4.27.1 (13 days ago) Apr 25 2008 compare
10,159 3.5.5 (9 months ago) Sep 04 2020 compare
11,155 chromedp (a month ago) Nov 27 2019 compare
1,835 0.4.0 (10 months ago) Dec 28 2012 compare
2,951 v2.1.1 (1 year, 7 days ago) Jul 17 2018 compare
642 1.9.4 (a month ago) Jul 22 2022 compare
4,100 3.5 (4 years ago) Apr 25 2014 compare
Was this page helpful?