Skip to content

Commit c4a38ab

Browse files
authored
feat(roll): roll Playwright 1.15.0-next-1629385562000 (microsoft#854)
1 parent 7de9061 commit c4a38ab

File tree

9 files changed

+112
-30
lines changed

9 files changed

+112
-30
lines changed

playwright/_impl/_browser.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ async def new_context(
106106
recordVideoSize: ViewportSize = None,
107107
storageState: Union[StorageState, str, Path] = None,
108108
baseURL: str = None,
109+
strictSelectors: bool = None,
109110
) -> BrowserContext:
110111
params = locals_to_params(locals())
111112
await normalize_context_params(self._connection._is_sync, params)
@@ -147,6 +148,7 @@ async def new_page(
147148
recordVideoSize: ViewportSize = None,
148149
storageState: Union[StorageState, str, Path] = None,
149150
baseURL: str = None,
151+
strictSelectors: bool = None,
150152
) -> Page:
151153
params = locals_to_params(locals())
152154
context = await self.new_context(**params)

playwright/_impl/_browser_context.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from_nullable_channel,
2929
)
3030
from playwright._impl._event_context_manager import EventContextManagerImpl
31+
from playwright._impl._frame import Frame
3132
from playwright._impl._helper import (
3233
RouteHandler,
3334
RouteHandlerEntry,
@@ -38,6 +39,7 @@
3839
async_writefile,
3940
is_safe_close_error,
4041
locals_to_params,
42+
to_impl,
4143
)
4244
from playwright._impl._network import Request, Response, Route, serialize_headers
4345
from playwright._impl._page import BindingCall, Page, Worker
@@ -368,10 +370,16 @@ def background_pages(self) -> List[Page]:
368370
def service_workers(self) -> List[Worker]:
369371
return list(self._service_workers)
370372

371-
async def new_cdp_session(self, page: Page) -> CDPSession:
372-
return from_channel(
373-
await self._channel.send("newCDPSession", {"page": page._channel})
374-
)
373+
async def new_cdp_session(self, page: Union[Page, Frame]) -> CDPSession:
374+
page = to_impl(page)
375+
params = {}
376+
if isinstance(page, Page):
377+
params["page"] = page._channel
378+
elif isinstance(page, Frame):
379+
params["frame"] = page._channel
380+
else:
381+
raise Error("page: expected Page or Frame")
382+
return from_channel(await self._channel.send("newCDPSession", params))
375383

376384
@property
377385
def tracing(self) -> Tracing:

playwright/_impl/_browser_type.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ async def launch_persistent_context(
133133
recordVideoDir: Union[Path, str] = None,
134134
recordVideoSize: ViewportSize = None,
135135
baseURL: str = None,
136+
strictSelectors: bool = None,
136137
) -> BrowserContext:
137138
userDataDir = str(Path(userDataDir))
138139
params = locals_to_params(locals())

playwright/_impl/_helper.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
List,
3030
Optional,
3131
Pattern,
32+
TypeVar,
3233
Union,
3334
cast,
3435
)
@@ -254,3 +255,12 @@ def inner() -> bytes:
254255

255256
loop = asyncio.get_running_loop()
256257
return await loop.run_in_executor(None, inner)
258+
259+
260+
T = TypeVar("T")
261+
262+
263+
def to_impl(obj: T) -> T:
264+
if hasattr(obj, "_impl_obj"):
265+
return cast(Any, obj)._impl_obj
266+
return obj

playwright/async_api/_generated.py

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3999,8 +3999,6 @@ def locator(self, selector: str) -> "Locator":
39993999
element immediately before performing an action, so a series of actions on the same locator can in fact be performed on
40004000
different DOM elements. That would happen if the DOM structure between those actions has changed.
40014001
4002-
Note that locator always implies visibility, so it will always be locating visible elements.
4003-
40044002
Parameters
40054003
----------
40064004
selector : str
@@ -7344,8 +7342,6 @@ def locator(self, selector: str) -> "Locator":
73447342
element immediately before performing an action, so a series of actions on the same locator can in fact be performed on
73457343
different DOM elements. That would happen if the DOM structure between those actions has changed.
73467344
7347-
Note that locator always implies visibility, so it will always be locating visible elements.
7348-
73497345
Shortcut for main frame's `frame.locator()`.
73507346
73517347
Parameters
@@ -9469,7 +9465,9 @@ def expect_page(
94699465
).future
94709466
)
94719467

9472-
async def new_cdp_session(self, page: "Page") -> "CDPSession":
9468+
async def new_cdp_session(
9469+
self, page: typing.Union["Page", "Frame"]
9470+
) -> "CDPSession":
94739471
"""BrowserContext.new_cdp_session
94749472
94759473
> NOTE: CDP sessions are only supported on Chromium-based browsers.
@@ -9478,8 +9476,9 @@ async def new_cdp_session(self, page: "Page") -> "CDPSession":
94789476
94799477
Parameters
94809478
----------
9481-
page : Page
9482-
Page to create new session for.
9479+
page : Union[Frame, Page]
9480+
Target to create new session for. For backwards-compatability, this parameter is named `page`, but it can be a `Page` or
9481+
`Frame` type.
94839482
94849483
Returns
94859484
-------
@@ -9489,7 +9488,7 @@ async def new_cdp_session(self, page: "Page") -> "CDPSession":
94899488
return mapping.from_impl(
94909489
await self._async(
94919490
"browser_context.new_cdp_session",
9492-
self._impl_obj.new_cdp_session(page=page._impl_obj),
9491+
self._impl_obj.new_cdp_session(page=page),
94939492
)
94949493
)
94959494

@@ -9615,7 +9614,8 @@ async def new_context(
96159614
record_video_dir: typing.Union[str, pathlib.Path] = None,
96169615
record_video_size: ViewportSize = None,
96179616
storage_state: typing.Union[StorageState, str, pathlib.Path] = None,
9618-
base_url: str = None
9617+
base_url: str = None,
9618+
strict_selectors: bool = None
96199619
) -> "BrowserContext":
96209620
"""Browser.new_context
96219621
@@ -9709,6 +9709,10 @@ async def new_context(
97099709
Examples:
97109710
- baseURL: `http://localhost:3000` and navigating to `/bar.html` results in `http://localhost:3000/bar.html`
97119711
- baseURL: `http://localhost:3000/foo/` and navigating to `./bar.html` results in `http://localhost:3000/foo/bar.html`
9712+
strict_selectors : Union[bool, NoneType]
9713+
It specified, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors
9714+
that imply single target DOM element will throw when more than one element matches the selector. See `Locator` to learn
9715+
more about the strict mode.
97129716
97139717
Returns
97149718
-------
@@ -9747,6 +9751,7 @@ async def new_context(
97479751
recordVideoSize=record_video_size,
97489752
storageState=storage_state,
97499753
baseURL=base_url,
9754+
strictSelectors=strict_selectors,
97509755
),
97519756
)
97529757
)
@@ -9781,7 +9786,8 @@ async def new_page(
97819786
record_video_dir: typing.Union[str, pathlib.Path] = None,
97829787
record_video_size: ViewportSize = None,
97839788
storage_state: typing.Union[StorageState, str, pathlib.Path] = None,
9784-
base_url: str = None
9789+
base_url: str = None,
9790+
strict_selectors: bool = None
97859791
) -> "Page":
97869792
"""Browser.new_page
97879793
@@ -9870,6 +9876,10 @@ async def new_page(
98709876
Examples:
98719877
- baseURL: `http://localhost:3000` and navigating to `/bar.html` results in `http://localhost:3000/bar.html`
98729878
- baseURL: `http://localhost:3000/foo/` and navigating to `./bar.html` results in `http://localhost:3000/foo/bar.html`
9879+
strict_selectors : Union[bool, NoneType]
9880+
It specified, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors
9881+
that imply single target DOM element will throw when more than one element matches the selector. See `Locator` to learn
9882+
more about the strict mode.
98739883
98749884
Returns
98759885
-------
@@ -9908,6 +9918,7 @@ async def new_page(
99089918
recordVideoSize=record_video_size,
99099919
storageState=storage_state,
99109920
baseURL=base_url,
9921+
strictSelectors=strict_selectors,
99119922
),
99129923
)
99139924
)
@@ -10218,7 +10229,8 @@ async def launch_persistent_context(
1021810229
record_har_omit_content: bool = None,
1021910230
record_video_dir: typing.Union[str, pathlib.Path] = None,
1022010231
record_video_size: ViewportSize = None,
10221-
base_url: str = None
10232+
base_url: str = None,
10233+
strict_selectors: bool = None
1022210234
) -> "BrowserContext":
1022310235
"""BrowserType.launch_persistent_context
1022410236
@@ -10345,6 +10357,10 @@ async def launch_persistent_context(
1034510357
Examples:
1034610358
- baseURL: `http://localhost:3000` and navigating to `/bar.html` results in `http://localhost:3000/bar.html`
1034710359
- baseURL: `http://localhost:3000/foo/` and navigating to `./bar.html` results in `http://localhost:3000/foo/bar.html`
10360+
strict_selectors : Union[bool, NoneType]
10361+
It specified, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors
10362+
that imply single target DOM element will throw when more than one element matches the selector. See `Locator` to learn
10363+
more about the strict mode.
1034810364
1034910365
Returns
1035010366
-------
@@ -10397,6 +10413,7 @@ async def launch_persistent_context(
1039710413
recordVideoDir=record_video_dir,
1039810414
recordVideoSize=record_video_size,
1039910415
baseURL=base_url,
10416+
strictSelectors=strict_selectors,
1040010417
),
1040110418
)
1040210419
)
@@ -11009,7 +11026,7 @@ async def evaluate(
1100911026
Examples:
1101011027
1101111028
```py
11012-
tweets = await page.locator(\".tweet .retweets\")
11029+
tweets = page.locator(\".tweet .retweets\")
1101311030
assert await tweets.evaluate(\"node => node.innerText\") == \"10 retweets\"
1101411031
```
1101511032

playwright/sync_api/_generated.py

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3977,8 +3977,6 @@ def locator(self, selector: str) -> "Locator":
39773977
element immediately before performing an action, so a series of actions on the same locator can in fact be performed on
39783978
different DOM elements. That would happen if the DOM structure between those actions has changed.
39793979
3980-
Note that locator always implies visibility, so it will always be locating visible elements.
3981-
39823980
Parameters
39833981
----------
39843982
selector : str
@@ -7299,8 +7297,6 @@ def locator(self, selector: str) -> "Locator":
72997297
element immediately before performing an action, so a series of actions on the same locator can in fact be performed on
73007298
different DOM elements. That would happen if the DOM structure between those actions has changed.
73017299
7302-
Note that locator always implies visibility, so it will always be locating visible elements.
7303-
73047300
Shortcut for main frame's `frame.locator()`.
73057301
73067302
Parameters
@@ -9410,7 +9406,7 @@ def expect_page(
94109406
).future,
94119407
)
94129408

9413-
def new_cdp_session(self, page: "Page") -> "CDPSession":
9409+
def new_cdp_session(self, page: typing.Union["Page", "Frame"]) -> "CDPSession":
94149410
"""BrowserContext.new_cdp_session
94159411
94169412
> NOTE: CDP sessions are only supported on Chromium-based browsers.
@@ -9419,8 +9415,9 @@ def new_cdp_session(self, page: "Page") -> "CDPSession":
94199415
94209416
Parameters
94219417
----------
9422-
page : Page
9423-
Page to create new session for.
9418+
page : Union[Frame, Page]
9419+
Target to create new session for. For backwards-compatability, this parameter is named `page`, but it can be a `Page` or
9420+
`Frame` type.
94249421
94259422
Returns
94269423
-------
@@ -9430,7 +9427,7 @@ def new_cdp_session(self, page: "Page") -> "CDPSession":
94309427
return mapping.from_impl(
94319428
self._sync(
94329429
"browser_context.new_cdp_session",
9433-
self._impl_obj.new_cdp_session(page=page._impl_obj),
9430+
self._impl_obj.new_cdp_session(page=page),
94349431
)
94359432
)
94369433

@@ -9556,7 +9553,8 @@ def new_context(
95569553
record_video_dir: typing.Union[str, pathlib.Path] = None,
95579554
record_video_size: ViewportSize = None,
95589555
storage_state: typing.Union[StorageState, str, pathlib.Path] = None,
9559-
base_url: str = None
9556+
base_url: str = None,
9557+
strict_selectors: bool = None
95609558
) -> "BrowserContext":
95619559
"""Browser.new_context
95629560
@@ -9650,6 +9648,10 @@ def new_context(
96509648
Examples:
96519649
- baseURL: `http://localhost:3000` and navigating to `/bar.html` results in `http://localhost:3000/bar.html`
96529650
- baseURL: `http://localhost:3000/foo/` and navigating to `./bar.html` results in `http://localhost:3000/foo/bar.html`
9651+
strict_selectors : Union[bool, NoneType]
9652+
It specified, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors
9653+
that imply single target DOM element will throw when more than one element matches the selector. See `Locator` to learn
9654+
more about the strict mode.
96539655
96549656
Returns
96559657
-------
@@ -9688,6 +9690,7 @@ def new_context(
96889690
recordVideoSize=record_video_size,
96899691
storageState=storage_state,
96909692
baseURL=base_url,
9693+
strictSelectors=strict_selectors,
96919694
),
96929695
)
96939696
)
@@ -9722,7 +9725,8 @@ def new_page(
97229725
record_video_dir: typing.Union[str, pathlib.Path] = None,
97239726
record_video_size: ViewportSize = None,
97249727
storage_state: typing.Union[StorageState, str, pathlib.Path] = None,
9725-
base_url: str = None
9728+
base_url: str = None,
9729+
strict_selectors: bool = None
97269730
) -> "Page":
97279731
"""Browser.new_page
97289732
@@ -9811,6 +9815,10 @@ def new_page(
98119815
Examples:
98129816
- baseURL: `http://localhost:3000` and navigating to `/bar.html` results in `http://localhost:3000/bar.html`
98139817
- baseURL: `http://localhost:3000/foo/` and navigating to `./bar.html` results in `http://localhost:3000/foo/bar.html`
9818+
strict_selectors : Union[bool, NoneType]
9819+
It specified, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors
9820+
that imply single target DOM element will throw when more than one element matches the selector. See `Locator` to learn
9821+
more about the strict mode.
98149822
98159823
Returns
98169824
-------
@@ -9849,6 +9857,7 @@ def new_page(
98499857
recordVideoSize=record_video_size,
98509858
storageState=storage_state,
98519859
baseURL=base_url,
9860+
strictSelectors=strict_selectors,
98529861
),
98539862
)
98549863
)
@@ -10159,7 +10168,8 @@ def launch_persistent_context(
1015910168
record_har_omit_content: bool = None,
1016010169
record_video_dir: typing.Union[str, pathlib.Path] = None,
1016110170
record_video_size: ViewportSize = None,
10162-
base_url: str = None
10171+
base_url: str = None,
10172+
strict_selectors: bool = None
1016310173
) -> "BrowserContext":
1016410174
"""BrowserType.launch_persistent_context
1016510175
@@ -10286,6 +10296,10 @@ def launch_persistent_context(
1028610296
Examples:
1028710297
- baseURL: `http://localhost:3000` and navigating to `/bar.html` results in `http://localhost:3000/bar.html`
1028810298
- baseURL: `http://localhost:3000/foo/` and navigating to `./bar.html` results in `http://localhost:3000/foo/bar.html`
10299+
strict_selectors : Union[bool, NoneType]
10300+
It specified, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors
10301+
that imply single target DOM element will throw when more than one element matches the selector. See `Locator` to learn
10302+
more about the strict mode.
1028910303
1029010304
Returns
1029110305
-------
@@ -10338,6 +10352,7 @@ def launch_persistent_context(
1033810352
recordVideoDir=record_video_dir,
1033910353
recordVideoSize=record_video_size,
1034010354
baseURL=base_url,
10355+
strictSelectors=strict_selectors,
1034110356
),
1034210357
)
1034310358
)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
InWheel = None
2929
from wheel.bdist_wheel import bdist_wheel as BDistWheelCommand
3030

31-
driver_version = "1.14.0-1628783206000"
31+
driver_version = "1.15.0-next-1629385562000"
3232

3333

3434
def extractall(zip: zipfile.ZipFile, path: str) -> None:

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