File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -588,6 +588,7 @@ async def screenshot(
588588 lambda h , timeout : h .screenshot (
589589 ** {** params , "timeout" : timeout },
590590 ),
591+ timeout ,
591592 )
592593
593594 async def aria_snapshot (
Original file line number Diff line number Diff line change @@ -411,6 +411,13 @@ async def test_locators_should_screenshot(
411411 )
412412
413413
414+ async def test_locators_screenshot_should_respect_timeout (page : Page ) -> None :
415+ page .set_default_timeout (5_000 )
416+ await page .set_content ("<div>hello</div>" )
417+ with pytest .raises (Error , match = "Locator.screenshot: Timeout 500ms exceeded." ):
418+ await page .locator ("#missing" ).screenshot (timeout = 500 )
419+
420+
414421async def test_locators_should_return_bounding_box (page : Page , server : Server ) -> None :
415422 await page .set_viewport_size (
416423 {
Original file line number Diff line number Diff line change @@ -394,6 +394,13 @@ def test_locators_should_screenshot(
394394 )
395395
396396
397+ def test_locators_screenshot_should_respect_timeout (page : Page ) -> None :
398+ page .set_default_timeout (5_000 )
399+ page .set_content ("<div>hello</div>" )
400+ with pytest .raises (Error , match = "Locator.screenshot: Timeout 500ms exceeded." ):
401+ page .locator ("#missing" ).screenshot (timeout = 500 )
402+
403+
397404def test_locators_should_return_bounding_box (page : Page , server : Server ) -> None :
398405 page .set_viewport_size (
399406 {
You can’t perform that action at this time.
0 commit comments