{"id":27304,"library":"pytest-playwright-asyncio","title":"pytest-playwright-asyncio","description":"A pytest plugin providing async fixtures for Playwright (via asyncio), enabling async/await browser automation in tests. Current version 0.7.2, requires Python >=3.10. Released as needed; follows pytest-playwright patterns.","status":"active","version":"0.7.2","language":"python","source_language":"en","source_url":"https://github.com/pytest-dev/pytest-playwright-asyncio","tags":["pytest","playwright","asyncio","testing","browser automation"],"install":[{"cmd":"pip install pytest-playwright-asyncio","lang":"bash","label":"Install from PyPI"},{"cmd":"playwright install","lang":"bash","label":"Install browser binaries"}],"dependencies":[{"reason":"Required for fixtures and test discovery","package":"pytest","optional":false},{"reason":"Required for browser automation","package":"playwright","optional":false},{"reason":"Required for async fixture support","package":"pytest-asyncio","optional":false}],"imports":[{"note":"No common mistake; use @pytest.mark.asyncio decorator","wrong":"","symbol":"pytest.mark.asyncio","correct":"from pytest import mark"}],"quickstart":{"code":"import pytest\nfrom playwright.async_api import Page\n\npytest_plugins = ['pytest_playwright_asyncio']\n\nasync def test_example(page: Page):\n    await page.goto('https://example.com')\n    assert await page.title() == 'Example Domain'","lang":"python","description":"Basic async test using the page fixture. Ensure you have a conftest.py with the plugin import or set pytest_plugins."},"warnings":[{"fix":"If you need function-scoped fixtures, explicitly set scope='function' in conftest.py.","message":"Version 0.7.0 dropped support for Python 3.8/3.9 and changed the default fixture scope from function to session. Tests relying on function-level isolation may fail.","severity":"breaking","affected_versions":">=0.7.0"},{"fix":"Use the 'context' fixture to share state between pages within a test.","message":"The 'page' fixture returns a new page in a new context per test by default. Do not reuse pages across tests as they are isolated.","severity":"gotcha","affected_versions":"all"},{"fix":"Use 'browser_type.launch()' instead of relying on the 'browser' fixture.","message":"The 'browser' fixture is deprecated in favor of 'browser_type' and 'launch_browser' for clarity.","severity":"deprecated","affected_versions":">=0.6.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Set in pytest.ini: [pytest] asyncio_mode = auto or use @pytest.mark.asyncio explicitly.","cause":"pytest-asyncio mode conflict: using 'auto' or 'strict' mode incorrectly.","error":"RuntimeError: Event loop is closed"},{"fix":"Install the package and ensure conftest.py has 'pytest_plugins = [\"pytest_playwright_asyncio\"]'.","cause":"pytest cannot find the plugin because it's not installed or not imported in conftest.","error":"ModuleNotFoundError: No module named 'pytest_playwright_asyncio'"},{"fix":"Ensure all Playwright calls are awaited: await page.goto('...')","cause":"Using sync Playwright methods (e.g., page.goto() without await) in an async test.","error":"playwright._impl._errors.Error: It looks like you are using Playwright Sync API inside an asyncio test"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}