Playwright and Pytest
Install Pytest Plugin
pip install pytest-playwright
Install the required browsers
playwright install
test_example.py
Running the Example Test
pytest
Using Test Hooks
import pytest
from playwright.sync_api import Page, expect
@pytest.fixture(scope="function", autouse=True)
def before_each_after_each(page: Page):
print("before the test runs")
# Go to the starting url before each test.
page.goto("https://playwright.dev/")
yield
print("after the test runs")
def test_main_navigation(page: Page):
# Assertions use the expect API.
expect(page).to_have_url("https://playwright.dev/")
Running tests headed
pytest --headed
Running tests on different browsers and multiple browser
pytest --browser webkit
pytest --browser webkit --browser firefox
Running specific tests
pytest test_login.py
To run a set of test files pass in the names of the test files that you want to run.
pytest tests/test_todo_page.py tests/test_landing_page.py
To run a specific test pass in the function name of the test you want to run.
pytest -k test_add_a_todo_item
Run tests in Parallel
pytest --numprocesses 2
Metadata
Release files for playwright-project 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| playwright_project-0.0.5.tar.gz | 2.4 kB | Without provenance | Details for playwright_project-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| playwright_project-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for playwright_project-0.0.5-py3-none-any.whl |
Total release size: 5.4 kB
Release files / playwright_project-0.0.5.tar.gz
| Download URL | playwright_project-0.0.5.tar.gz |
|---|---|
| Size | 2.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b88285dfc1393e80e6b5dcfe3b93fa99f951d971653ebe452427f58a01fb6d5a
|
|
BLAKE2b-256 checksum How to use checksums |
e1d9f80327829a2b8567fed987eba4510e774ef3437d613d10ebe1a55f296fd8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.11.6 Windows/10
|
Release files / playwright_project-0.0.5-py3-none-any.whl
| Download URL | playwright_project-0.0.5-py3-none-any.whl |
|---|---|
| Size | 3.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6d33da96b4d03f6635fd7aae0cad7d368f27192700433818046578896c6dfec6
|
|
BLAKE2b-256 checksum How to use checksums |
d9ec4265af2c33bc2e86c43930503dc54b29b6742907f5f78d4b15d7d2506cfe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.11.6 Windows/10
|
Security for playwright-project 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.