Skip to content

Commit 5ad2780

Browse files
committed
More timeout operation fixes
1 parent 2bdd016 commit 5ad2780

File tree

4 files changed

+18
-14
lines changed

4 files changed

+18
-14
lines changed

playwright/_impl/_frame.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -370,14 +370,10 @@ async def is_enabled(
370370
)
371371

372372
async def is_hidden(self, selector: str, strict: bool = None) -> bool:
373-
return await self._channel.send(
374-
"isHidden", self._locals_to_params_with_timeout(locals())
375-
)
373+
return await self._channel.send("isHidden", locals_to_params(locals()))
376374

377375
async def is_visible(self, selector: str, strict: bool = None) -> bool:
378-
return await self._channel.send(
379-
"isVisible", self._locals_to_params_with_timeout(locals())
380-
)
376+
return await self._channel.send("isVisible", locals_to_params(locals()))
381377

382378
async def dispatch_event(
383379
self,
@@ -865,5 +861,6 @@ def _locals_to_params_with_navigation_timeout(self, args: Dict) -> Dict:
865861
def _locals_to_params_without_timeout(self, args: Dict) -> Dict:
866862
params = locals_to_params(locals())
867863
# Timeout is deprecated and does nothing
868-
del params["timeout"]
864+
if "timeout" in params:
865+
del params["timeout"]
869866
return params

playwright/_impl/_locator.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ async def evaluate(
191191
)
192192

193193
async def evaluate_all(self, expression: str, arg: Serializable = None) -> Any:
194-
params = self._locals_to_params_with_timeout(locals())
194+
params = locals_to_params(locals())
195195
return await self._frame.eval_on_selector_all(self._selector, **params)
196196

197197
async def evaluate_handle(
@@ -500,15 +500,15 @@ async def is_enabled(self, timeout: float = None) -> bool:
500500
)
501501

502502
async def is_hidden(self, timeout: float = None) -> bool:
503-
params = self._locals_to_params_with_timeout(locals())
503+
params = self._locals_to_params_without_timeout(locals())
504504
return await self._frame.is_hidden(
505505
self._selector,
506506
strict=True,
507507
**params,
508508
)
509509

510510
async def is_visible(self, timeout: float = None) -> bool:
511-
params = self._locals_to_params_with_timeout(locals())
511+
params = self._locals_to_params_without_timeout(locals())
512512
return await self._frame.is_visible(
513513
self._selector,
514514
strict=True,
@@ -742,6 +742,13 @@ def _locals_to_params_with_timeout(self, args: Dict) -> Dict:
742742
params["timeout"] = self._frame._timeout(params.get("timeout"))
743743
return params
744744

745+
def _locals_to_params_without_timeout(self, args: Dict) -> Dict:
746+
params = locals_to_params(args)
747+
# Timeout is deprecated and does nothing
748+
if "timeout" in params:
749+
del params["timeout"]
750+
return params
751+
745752

746753
class FrameLocator:
747754
def __init__(self, frame: "Frame", frame_selector: str) -> None:

tests/async/test_tracing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,9 +379,9 @@ async def test_should_show_tracing_group_in_action_list(
379379
await trace_viewer.expand_action("inner group 1")
380380
await expect(trace_viewer.action_titles).to_have_text(
381381
[
382-
re.compile(r"New page"),
382+
re.compile(r"Create page"),
383383
re.compile(r"outer group"),
384-
re.compile(r"Navigate to data:"),
384+
re.compile(r"Navigate to \"data:\""),
385385
re.compile(r"inner group 1"),
386386
re.compile(r"Click"),
387387
re.compile(r"inner group 2"),

tests/sync/test_tracing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,9 +378,9 @@ def test_should_show_tracing_group_in_action_list(
378378
trace_viewer.expand_action("inner group 1")
379379
expect(trace_viewer.action_titles).to_have_text(
380380
[
381-
re.compile(r"New page"),
381+
re.compile(r"Create page"),
382382
re.compile(r"outer group"),
383-
re.compile(r"Navigate to data:"),
383+
re.compile(r"Navigate to \"data:\""),
384384
re.compile(r"inner group 1"),
385385
re.compile(r"Click"),
386386
re.compile(r"inner group 2"),

0 commit comments

Comments
 (0)