MCPcopy Index your code
hub / github.com/microsoft/playwright-python / test_locators_should_screenshot

Function test_locators_should_screenshot

tests/async/test_locators.py:397–411  ·  view source on GitHub ↗
(
    page: Page, server: Server, assert_to_be_golden: Callable[[bytes, str], None]
)

Source from the content-addressed store, hash-verified

395
396
397async def test_locators_should_screenshot(
398 page: Page, server: Server, assert_to_be_golden: Callable[[bytes, str], None]
399) -> None:
400 await page.set_viewport_size(
401 {
402 "width": 500,
403 "height": 500,
404 }
405 )
406 await page.goto(server.PREFIX + "/grid.html")
407 await page.evaluate("window.scrollBy(50, 100)")
408 element = page.locator(".box:nth-of-type(3)")
409 assert_to_be_golden(
410 await element.screenshot(), "screenshot-element-bounding-box.png"
411 )
412
413
414async def test_locators_should_return_bounding_box(page: Page, server: Server) -> None:

Callers

nothing calls this directly

Calls 6

assert_to_be_goldenFunction · 0.85
set_viewport_sizeMethod · 0.45
gotoMethod · 0.45
evaluateMethod · 0.45
locatorMethod · 0.45
screenshotMethod · 0.45

Tested by

no test coverage detected