Skip to content

Commit 0e672c0

Browse files
authored
chore: roll Playwright to 1.20.0-alpha-mar-3-2022 (microsoft#1179)
1 parent e7e0f52 commit 0e672c0

21 files changed

+352
-132
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Playwright is a Python library to automate [Chromium](https://www.chromium.org/H
44

55
| | Linux | macOS | Windows |
66
| :--- | :---: | :---: | :---: |
7-
| Chromium <!-- GEN:chromium-version -->100.0.4863.0<!-- GEN:stop --> ||||
7+
| Chromium <!-- GEN:chromium-version -->101.0.4915.0<!-- GEN:stop --> ||||
88
| WebKit <!-- GEN:webkit-version -->15.4<!-- GEN:stop --> ||||
99
| Firefox <!-- GEN:firefox-version -->96.0.1<!-- GEN:stop --> ||||
1010

playwright/_impl/_element_handle.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141

4242
if TYPE_CHECKING: # pragma: no cover
4343
from playwright._impl._frame import Frame
44+
from playwright._impl._locator import Locator
4445

4546

4647
class ElementHandle(JSHandle):
@@ -269,10 +270,24 @@ async def screenshot(
269270
path: Union[str, Path] = None,
270271
quality: int = None,
271272
omitBackground: bool = None,
273+
disableAnimations: bool = None,
274+
mask: List["Locator"] = None,
272275
) -> bytes:
273276
params = locals_to_params(locals())
274277
if "path" in params:
275278
del params["path"]
279+
if "mask" in params:
280+
params["mask"] = list(
281+
map(
282+
lambda locator: (
283+
{
284+
"frame": locator._frame._channel,
285+
"selector": locator._selector,
286+
}
287+
),
288+
params["mask"],
289+
)
290+
)
276291
encoded_binary = await self._channel.send("screenshot", params)
277292
decoded_binary = base64.b64decode(encoded_binary)
278293
if path:

playwright/_impl/_frame.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,3 +695,6 @@ async def set_checked(
695695
strict=strict,
696696
trial=trial,
697697
)
698+
699+
async def _highlight(self, selector: str) -> None:
700+
await self._channel.send("highlight", {"selector": selector})

playwright/_impl/_locator.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,14 +227,14 @@ async def element_handles(self) -> List[ElementHandle]:
227227

228228
@property
229229
def first(self) -> "Locator":
230-
return Locator(self._frame, f"{self._selector} >> nth=0")
230+
return Locator(self._frame, f"{self._selector} >> nth=0")
231231

232232
@property
233233
def last(self) -> "Locator":
234-
return Locator(self._frame, f"{self._selector} >> nth=-1")
234+
return Locator(self._frame, f"{self._selector} >> nth=-1")
235235

236236
def nth(self, index: int) -> "Locator":
237-
return Locator(self._frame, f"{self._selector} >> nth={index}")
237+
return Locator(self._frame, f"{self._selector} >> nth={index}")
238238

239239
async def focus(self, timeout: float = None) -> None:
240240
params = locals_to_params(locals())
@@ -373,6 +373,8 @@ async def screenshot(
373373
path: Union[str, pathlib.Path] = None,
374374
quality: int = None,
375375
omitBackground: bool = None,
376+
disableAnimations: bool = None,
377+
mask: List["Locator"] = None,
376378
) -> bytes:
377379
params = locals_to_params(locals())
378380
return await self._with_element(
@@ -549,6 +551,9 @@ async def _expect(
549551
result["received"] = parse_value(result["received"])
550552
return result
551553

554+
async def highlight(self) -> None:
555+
await self._frame._highlight(self._selector)
556+
552557

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

playwright/_impl/_page.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,10 +604,24 @@ async def screenshot(
604604
omitBackground: bool = None,
605605
fullPage: bool = None,
606606
clip: FloatRect = None,
607+
disableAnimations: bool = None,
608+
mask: List["Locator"] = None,
607609
) -> bytes:
608610
params = locals_to_params(locals())
609611
if "path" in params:
610612
del params["path"]
613+
if "mask" in params:
614+
params["mask"] = list(
615+
map(
616+
lambda locator: (
617+
{
618+
"frame": locator._frame._channel,
619+
"selector": locator._selector,
620+
}
621+
),
622+
params["mask"],
623+
)
624+
)
611625
encoded_binary = await self._channel.send("screenshot", params)
612626
decoded_binary = base64.b64decode(encoded_binary)
613627
if path:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy