Skip to content

Commit 79f6ce0

Browse files
authored
chore: implement 1.8 API methods (microsoft#421)
1 parent 47d42d8 commit 79f6ce0

16 files changed

+2127
-177
lines changed

playwright/_impl/_element_handle.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,24 @@ async def inner_text(self) -> str:
6767
async def inner_html(self) -> str:
6868
return await self._channel.send("innerHTML")
6969

70+
async def is_checked(self) -> bool:
71+
return await self._channel.send("isChecked")
72+
73+
async def is_disabled(self) -> bool:
74+
return await self._channel.send("isDisabled")
75+
76+
async def is_editable(self) -> bool:
77+
return await self._channel.send("isEditable")
78+
79+
async def is_enabled(self) -> bool:
80+
return await self._channel.send("isEnabled")
81+
82+
async def is_hidden(self) -> bool:
83+
return await self._channel.send("isHidden")
84+
85+
async def is_visible(self) -> bool:
86+
return await self._channel.send("isVisible")
87+
7088
async def dispatch_event(self, type: str, eventInit: Dict = None) -> None:
7189
await self._channel.send(
7290
"dispatchEvent", dict(type=type, eventInit=serialize_argument(eventInit))
@@ -260,7 +278,9 @@ async def eval_on_selector_all(
260278

261279
async def wait_for_element_state(
262280
self,
263-
state: Literal["disabled", "enabled", "hidden", "stable", "visible"],
281+
state: Literal[
282+
"disabled", "editable", "enabled", "hidden", "stable", "visible"
283+
],
264284
timeout: float = None,
265285
) -> None:
266286
await self._channel.send("waitForElementState", locals_to_params(locals()))

playwright/_impl/_frame.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,24 @@ async def wait_for_selector(
246246
await self._channel.send("waitForSelector", locals_to_params(locals()))
247247
)
248248

249+
async def is_checked(self, selector: str, timeout: float = None) -> bool:
250+
return await self._channel.send("isChecked", locals_to_params(locals()))
251+
252+
async def is_disabled(self, selector: str, timeout: float = None) -> bool:
253+
return await self._channel.send("isDisabled", locals_to_params(locals()))
254+
255+
async def is_editable(self, selector: str, timeout: float = None) -> bool:
256+
return await self._channel.send("isEditable", locals_to_params(locals()))
257+
258+
async def is_enabled(self, selector: str, timeout: float = None) -> bool:
259+
return await self._channel.send("isEnabled", locals_to_params(locals()))
260+
261+
async def is_hidden(self, selector: str, timeout: float = None) -> bool:
262+
return await self._channel.send("isHidden", locals_to_params(locals()))
263+
264+
async def is_visible(self, selector: str, timeout: float = None) -> bool:
265+
return await self._channel.send("isVisible", locals_to_params(locals()))
266+
249267
async def dispatch_event(
250268
self, selector: str, type: str, eventInit: Dict = None, timeout: float = None
251269
) -> None:

playwright/_impl/_page.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,24 @@ async def wait_for_selector(
360360
) -> Optional[ElementHandle]:
361361
return await self._main_frame.wait_for_selector(**locals_to_params(locals()))
362362

363+
async def is_checked(self, selector: str, timeout: float = None) -> bool:
364+
return await self._main_frame.is_checked(**locals_to_params(locals()))
365+
366+
async def is_disabled(self, selector: str, timeout: float = None) -> bool:
367+
return await self._main_frame.is_disabled(**locals_to_params(locals()))
368+
369+
async def is_editable(self, selector: str, timeout: float = None) -> bool:
370+
return await self._main_frame.is_editable(**locals_to_params(locals()))
371+
372+
async def is_enabled(self, selector: str, timeout: float = None) -> bool:
373+
return await self._main_frame.is_enabled(**locals_to_params(locals()))
374+
375+
async def is_hidden(self, selector: str, timeout: float = None) -> bool:
376+
return await self._main_frame.is_hidden(**locals_to_params(locals()))
377+
378+
async def is_visible(self, selector: str, timeout: float = None) -> bool:
379+
return await self._main_frame.is_visible(**locals_to_params(locals()))
380+
363381
async def dispatch_event(
364382
self, selector: str, type: str, eventInit: Dict = None, timeout: float = None
365383
) -> None:

0 commit comments

Comments
 (0)