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
8 changes: 5 additions & 3 deletions playwright/_impl/_locator.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ async def evaluate_handle(
self, expression: str, arg: Serializable = None, timeout: float = None
) -> "JSHandle":
return await self._with_element(
lambda h, o: h.evaluate_handle(expression, arg), timeout
lambda h, _: h.evaluate_handle(expression, arg), timeout
)

async def fill(
Expand Down Expand Up @@ -518,7 +518,9 @@ async def screenshot(
) -> bytes:
params = locals_to_params(locals())
return await self._with_element(
lambda h, timeout: h.screenshot(timeout=timeout, **params)
lambda h, timeout: h.screenshot(
**{**params, "timeout": timeout}, # type: ignore
),
)

async def scroll_into_view_if_needed(
Expand Down Expand Up @@ -550,7 +552,7 @@ async def select_option(
async def select_text(self, force: bool = None, timeout: float = None) -> None:
params = locals_to_params(locals())
return await self._with_element(
lambda h, timeout: h.select_text(timeout=timeout, **params), timeout
lambda h, timeout: h.select_text(**{**params, "timeout": timeout}), timeout # type: ignore
)

async def set_input_files(
Expand Down
4 changes: 4 additions & 0 deletions tests/sync/test_locators.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ def test_locators_should_select_textarea(
textarea = page.locator("textarea")
textarea.evaluate("textarea => textarea.value = 'some value'")
textarea.select_text()
textarea.select_text(timeout=1_000)
if browser_name == "firefox" or browser_name == "webkit":
assert textarea.evaluate("el => el.selectionStart") == 0
assert textarea.evaluate("el => el.selectionEnd") == 10
Expand All @@ -381,6 +382,9 @@ def test_locators_should_screenshot(
page.evaluate("window.scrollBy(50, 100)")
element = page.locator(".box:nth-of-type(3)")
assert_to_be_golden(element.screenshot(), "screenshot-element-bounding-box.png")
assert_to_be_golden(
element.screenshot(timeout=1_000), "screenshot-element-bounding-box.png"
)


def test_locators_should_return_bounding_box(page: Page, server: Server) -> None:
Expand Down