Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions playwright/_impl/_locator.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,7 @@ async def screenshot(
lambda h, timeout: h.screenshot(
**{**params, "timeout": timeout},
),
timeout,
)

async def aria_snapshot(
Expand Down
7 changes: 7 additions & 0 deletions tests/async/test_locators.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,13 @@ async def test_locators_should_screenshot(
)


async def test_locators_screenshot_should_respect_timeout(page: Page) -> None:
page.set_default_timeout(5_000)
await page.set_content("<div>hello</div>")
with pytest.raises(Error, match="Locator.screenshot: Timeout 500ms exceeded."):
await page.locator("#missing").screenshot(timeout=500)


async def test_locators_should_return_bounding_box(page: Page, server: Server) -> None:
await page.set_viewport_size(
{
Expand Down
7 changes: 7 additions & 0 deletions tests/sync/test_locators.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,13 @@ def test_locators_should_screenshot(
)


def test_locators_screenshot_should_respect_timeout(page: Page) -> None:
page.set_default_timeout(5_000)
page.set_content("<div>hello</div>")
with pytest.raises(Error, match="Locator.screenshot: Timeout 500ms exceeded."):
page.locator("#missing").screenshot(timeout=500)


def test_locators_should_return_bounding_box(page: Page, server: Server) -> None:
page.set_viewport_size(
{
Expand Down
Loading