Skip to content

Commit f4a68cd

Browse files
m9810223mxschmitt
andauthored
fix: remove duplicated keyword argument timeout (#1870)
Co-authored-by: Max Schmitt <[email protected]>
1 parent 47caa7c commit f4a68cd

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

playwright/_impl/_locator.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ async def evaluate_handle(
197197
self, expression: str, arg: Serializable = None, timeout: float = None
198198
) -> "JSHandle":
199199
return await self._with_element(
200-
lambda h, o: h.evaluate_handle(expression, arg), timeout
200+
lambda h, _: h.evaluate_handle(expression, arg), timeout
201201
)
202202

203203
async def fill(
@@ -518,7 +518,9 @@ async def screenshot(
518518
) -> bytes:
519519
params = locals_to_params(locals())
520520
return await self._with_element(
521-
lambda h, timeout: h.screenshot(timeout=timeout, **params)
521+
lambda h, timeout: h.screenshot(
522+
**{**params, "timeout": timeout}, # type: ignore
523+
),
522524
)
523525

524526
async def scroll_into_view_if_needed(
@@ -550,7 +552,7 @@ async def select_option(
550552
async def select_text(self, force: bool = None, timeout: float = None) -> None:
551553
params = locals_to_params(locals())
552554
return await self._with_element(
553-
lambda h, timeout: h.select_text(timeout=timeout, **params), timeout
555+
lambda h, timeout: h.select_text(**{**params, "timeout": timeout}), timeout # type: ignore
554556
)
555557

556558
async def set_input_files(

tests/sync/test_locators.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ def test_locators_should_select_textarea(
355355
textarea = page.locator("textarea")
356356
textarea.evaluate("textarea => textarea.value = 'some value'")
357357
textarea.select_text()
358+
textarea.select_text(timeout=1_000)
358359
if browser_name == "firefox" or browser_name == "webkit":
359360
assert textarea.evaluate("el => el.selectionStart") == 0
360361
assert textarea.evaluate("el => el.selectionEnd") == 10
@@ -381,6 +382,9 @@ def test_locators_should_screenshot(
381382
page.evaluate("window.scrollBy(50, 100)")
382383
element = page.locator(".box:nth-of-type(3)")
383384
assert_to_be_golden(element.screenshot(), "screenshot-element-bounding-box.png")
385+
assert_to_be_golden(
386+
element.screenshot(timeout=1_000), "screenshot-element-bounding-box.png"
387+
)
384388

385389

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

0 commit comments

Comments
 (0)