diff --git a/playwright/_impl/_locator.py b/playwright/_impl/_locator.py index ee39754d4..a39139f74 100644 --- a/playwright/_impl/_locator.py +++ b/playwright/_impl/_locator.py @@ -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( @@ -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( @@ -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( diff --git a/tests/sync/test_locators.py b/tests/sync/test_locators.py index 1055dfd37..8c00368d9 100644 --- a/tests/sync/test_locators.py +++ b/tests/sync/test_locators.py @@ -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 @@ -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: