Closed crazy-yuzhao closed 4 months ago
Are you creating multiple contexts? Then it sounds like https://github.com/microsoft/playwright-pytest/issues/111.
This plugin records a video for every page which gets created during a test-run. Could you maybe provide us a code snippet of whats not working?
[pytest]
addopts = -vs
--screenshot="only-on-failure"
--video="on"
from playwright.sync_api import Page
def test_01(page: Page):
page.goto('https://playwright.dev/')
with page.expect_popup() as page2_info:
page.locator('[href="https://github.com/microsoft/playwright"]').first.click()
page2 = page2_info.value
print(page2.title())
page uses @pytest.fixture(scope="session")
@pytest.fixture(scope="session")
def page(context: BrowserContext,
pytestconfig: Any,
request: pytest.FixtureRequest,
) -> Generator[Page, None, None]:
.........
what is the exact implementation of your page
fixture? We need more information to act on it, ideally something we can run locally with expected and actual outcome.
[pytest] addopts = -vs --screenshot="only-on-failure" --video="on" from playwright.sync_api import Page def test_01(page: Page): page.goto('https://playwright.dev/') with page.expect_popup() as page2_info: page.locator('[href="https://github.com/microsoft/playwright"]').first.click() page2 = page2_info.value print(page2.title()) page uses @pytest.fixture(scope="session") @pytest.fixture(scope="session") def page(context: BrowserContext, pytestconfig: Any, request: pytest.FixtureRequest, ) -> Generator[Page, None, None]: .........
I changed the scope of the fixture on the page to session, and this case(test_01) can be run locally.
Closing as part of the triage process since it seemed stale. Please create a new issue with a detailed reproducible or feature request if you still face issues.
pytest-playwirght uses --video="on" to record video. The use case steps will open multiple browser tabs. The recorded video only records the newly opened tab page, and does not record the content of the previous tab page. Whether it supports recording videos on multiple browser tabs, and you can control which tab to record videos for.