### Install pytest-playwright with uv Source: https://playwright.dev/python/docs/intro Install the Playwright Pytest plugin using uv. ```bash uv add pytest-playwright ``` -------------------------------- ### Install required browsers Source: https://playwright.dev/python/docs/intro Install the required browser binaries for Playwright. ```bash playwright install ``` -------------------------------- ### Example test file test_example.py Source: https://playwright.dev/python/docs/intro Example test file demonstrating title assertion and clicking a link using Playwright's sync API. ```python import re from playwright.sync_api import Page, expect def test_has_title(page: Page): page.goto("https://playwright.dev/") # Expect a title "to contain" a substring. expect(page).to_have_title(re.compile("Playwright")) def test_get_started_link(page: Page): page.goto("https://playwright.dev/") # Click the get started link. page.get_by_role("link", name="Get started").click() # Expects page to have a heading with the name of Installation. expect(page.get_by_role("heading", name="Installation")).to_be_visible() ``` -------------------------------- ### Install pytest-playwright with poetry Source: https://playwright.dev/python/docs/intro Install the Playwright Pytest plugin using Poetry. ```bash poetry add pytest-playwright ``` -------------------------------- ### Install pytest-playwright with pip Source: https://playwright.dev/python/docs/intro Install the Playwright Pytest plugin using pip. ```bash pip install pytest-playwright ``` -------------------------------- ### Run Playwright MCP server with npx @playwright/mcp@latest Source: https://playwright.dev/python Starts the Playwright MCP server, which provides AI agents with full browser control through structured accessibility snapshots. ```bash npx @playwright/mcp@latest ``` -------------------------------- ### Run tests with pytest Source: https://playwright.dev/python/docs/intro Run the example test using pytest. Tests run on chromium by default in headless mode. ```bash pytest ``` -------------------------------- ### Initialize Playwright Test with npm init playwright@latest Source: https://playwright.dev/python Use this command to set up a new Playwright Test project. It installs the test runner and configures the necessary files for writing and running tests. ```bash npm init playwright@latest ``` -------------------------------- ### Install Playwright CLI globally with npm i -g @playwright/cli@latest Source: https://playwright.dev/python Installs the Playwright CLI globally, enabling token-efficient browser automation for coding agents like Claude Code and GitHub Copilot. ```bash npm i -g @playwright/cli@latest ``` -------------------------------- ### Update Playwright with uv Source: https://playwright.dev/python/docs/intro Update Playwright and the Pytest plugin using uv. ```bash uv add --upgrade pytest-playwright playwright ``` -------------------------------- ### Update Playwright with poetry Source: https://playwright.dev/python/docs/intro Update Playwright and the Pytest plugin using Poetry. ```bash poetry update pytest-playwright playwright ``` -------------------------------- ### Update Playwright with pip Source: https://playwright.dev/python/docs/intro Update Playwright and the Pytest plugin using pip. ```bash pip install pytest-playwright playwright -U ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.