playwright

A high-level API to automate web browsers

82 个版本 Python >=3.9
Microsoft Corporation License-Expression: Apache-2.0
安装
pip install playwright
poetry add playwright
pipenv install playwright
conda install playwright
描述

🎭 Playwright for Python PyPI version Anaconda version Join Discord

Playwright is a Python library to automate Chromium, Firefox and WebKit browsers with a single API. Playwright delivers automation that is ever-green, capable, reliable and fast. See how Playwright is better.

Linux macOS Windows
Chromium 148.0.7778.96
WebKit 26.4
Firefox 150.0.2

Documentation

https://playwright.dev/python/docs/intro

API Reference

https://playwright.dev/python/docs/api/class-playwright

Example

from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    for browser_type in [p.chromium, p.firefox, p.webkit]:
        browser = browser_type.launch()
        page = browser.new_page()
        page.goto('http://playwright.dev')
        page.screenshot(path=f'example-{browser_type.name}.png')
        browser.close()
import asyncio
from playwright.async_api import async_playwright

async def main():
    async with async_playwright() as p:
        for browser_type in [p.chromium, p.firefox, p.webkit]:
            browser = await browser_type.launch()
            page = await browser.new_page()
            await page.goto('http://playwright.dev')
            await page.screenshot(path=f'example-{browser_type.name}.png')
            await browser.close()

asyncio.run(main())

Other languages

More comfortable in another programming language? Playwright is also available in

版本列表
1.60.0 2026-05-18
1.59.0 2026-04-29
1.58.0 2026-01-30
1.57.0 2025-12-09
1.56.0 2025-11-11
1.55.0 2025-08-28
1.54.0 2025-07-22
1.53.0 2025-06-25
1.52.0 2025-04-30
1.51.0 2025-03-18
1.50.0 2025-02-03
1.49.1 2024-12-10
1.49.0 2024-11-22
1.48.0 2024-10-21
1.47.0 2024-09-13
1.46.0 2024-08-12
1.45.1 2024-07-23
1.45.0 2024-07-03
1.44.0 2024-05-17
1.43.0 2024-04-09
1.42.0 2024-03-06
1.41.2 2024-02-06
1.41.1 2024-01-24
1.41.0 2024-01-17
1.40.0 2023-11-21
1.39.0 2023-10-17
1.38.0 2023-09-18
1.37.0 2023-08-14
1.36.0 2023-07-14
1.35.0 2023-06-13
1.34.0 2023-05-26
1.33.0 2023-05-03
1.32.1 2023-03-29
1.32.0 2023-03-27
1.31.1 2023-02-27
1.31.0 2023-02-21
1.30.0 2023-01-25
1.29.1 2023-01-04
1.29.0 2022-12-21
1.28.0 2022-11-16
1.27.1 2022-10-12
1.27.0 2022-10-07
1.26.1 2022-09-28
1.26.0 2022-09-20
1.25.2 2022-08-23
1.25.1 2022-08-16
1.25.0 2022-08-15
1.24.1 2022-08-01
1.24.0 2022-07-22
1.23.1 2022-07-14
1.23.0 2022-06-30
1.22.0 2022-05-13
1.21.0 2022-04-13
1.20.1 2022-03-23
1.20.0 2022-03-15
1.19.1 2022-02-25
1.19.0 2022-02-15
1.18.2 2022-02-01
1.18.1 2022-01-20
1.18.0 2022-01-19
1.17.2 2021-12-02
1.17.1 2021-11-30
1.17.0 2021-11-20
1.16.1 2021-10-29
1.16.0 2021-10-21
1.15.3 2021-10-05
1.15.2 2021-10-01
1.15.1 2021-09-30
1.15.0 2021-09-21
1.14.1 2021-08-24
1.14.0 2021-08-13
1.13.1 2021-07-29
1.13.0 2021-07-21
1.12.1 2021-06-11
1.12.0 2021-06-09
1.11.2 2021-05-20
1.11.1 2021-05-13
1.11.0 2021-05-10
1.10.0 2021-03-24
1.9.2 2021-03-10
1.9.1 2021-02-26
1.9.0 2021-02-24