Skip to content

playwright

15,108 9 - Apache-2.0
1.65.2 (14 Nov 2026) Feb 24 2021 131.2 million (month)

playwright is a Python package that allows developers to automate web browsers for end-to-end testing, web scraping, and web performance analysis. It is built on top of WebKit, Mozilla's Gecko, and Microsoft's EdgeHTML, and it is designed to be fast, reliable, and easy to use.

playwright is similar to Selenium, but it provides a more modern and powerful API, with features such as automatic waiting for elements, automatic retries, and built-in support for browser contexts, which allow you to open multiple pages in a single browser instance.

Playwright also provides an asynchronous client which makes scaling playwright-powered web scrapers easier than alternatives (like Selenium)

Example Use


from playwright import sync_playwright

# Start Playwright
with sync_playwright() as playwright:
    # Launch a browser instance
    browser = playwright.chromium.launch()
    # Open a new context (tab)
    context = browser.new_context()
    # Create a new page in the context
    page = context.new_page()

    # Navigate to a website
    page.goto("https://www.example.com")

    # Find an element by its id
    element = page.get_by_id("example-id")

    # Interact with the element
    element.click()

    # Fill an input form
    page.get_by_name("example-name").fill("example text")

    # Find and click a button
    page.get_by_xpath("//button[text()='Search']").click()

    # Wait for the page to load
    page.wait_for_selector("#results")

    # Get the page title
    print(page.title)

    # Close the browser
    browser.close()

Alternatives / Similar


34,589 4.52.0 (2026-10-29 13:09:41 ago) Apr 25 2008 compare
121,035 1.0.4 (2026-11-13 20:56:54 ago) Nov 01 2024 compare
12,907 3.5.5 (2024-02-17 17:18:36 ago) Sep 04 2020 compare
13,281 0.5.9 (2026-11-01 06:22:04 ago) Mar 01 2024 compare
4,939 0.50.99 (2026-10-26 13:47:46 ago) Jan 15 2024 compare
7,142 3.0.1 (2026-11-08 11:38:44 ago) Jun 01 2024 compare
1,834 0.7.1 (2026-11-13 15:27:15 ago) Dec 28 2012 compare
23,420 1.0.57 (2026-11-06 21:43:49 ago) Feb 01 2024 compare
859 1.9.4 (2024-10-22 01:41:19 ago) Jul 22 2022 compare
4,190 3.5 (2020-06-16 13:27:02 ago) Apr 25 2014 compare

Other Languages

100,187 1.65.1 (2026-11-14 06:11:24 ago) Jan 23 2015 compare
rod
7,156 v0.116.2 (2024-07-12 11:52:28 ago) Sep 23 2022 compare
26,052 4.4.0 (2026-11-14 00:29:47 ago) Oct 29 2024 compare
13,367 v0.23.1 (2026-11-14 02:20:56 ago) Feb 04 2022 compare
3,072 v2.4.0 (2026-01-08 05:29:21 ago) Jul 17 2018 compare
Was this page helpful?