Skip to content

Commit 7873afd

Browse files
authored
chore(roll): roll Playwright to 1.38.0 (microsoft#2075)
1 parent f416689 commit 7873afd

File tree

10 files changed

+69
-41
lines changed

10 files changed

+69
-41
lines changed

README.md

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

55
| | Linux | macOS | Windows |
66
| :--- | :---: | :---: | :---: |
7-
| Chromium <!-- GEN:chromium-version -->117.0.5938.35<!-- GEN:stop --> ||||
7+
| Chromium <!-- GEN:chromium-version -->117.0.5938.62<!-- GEN:stop --> ||||
88
| WebKit <!-- GEN:webkit-version -->17.0<!-- GEN:stop --> ||||
9-
| Firefox <!-- GEN:firefox-version -->115.0<!-- GEN:stop --> ||||
9+
| Firefox <!-- GEN:firefox-version -->117.0<!-- GEN:stop --> ||||
1010

1111
## Documentation
1212

playwright/_impl/_browser_context.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@
6969
)
7070
from playwright._impl._network import Request, Response, Route, serialize_headers
7171
from playwright._impl._page import BindingCall, Page, Worker
72-
from playwright._impl._page_error import PageError
7372
from playwright._impl._tracing import Tracing
7473
from playwright._impl._wait_helper import WaitHelper
74+
from playwright._impl._web_error import WebError
7575

7676
if TYPE_CHECKING: # pragma: no cover
7777
from playwright._impl._browser import Browser
@@ -89,7 +89,7 @@ class BrowserContext(ChannelOwner):
8989
Console="console",
9090
Dialog="dialog",
9191
Page="page",
92-
PageError="pageerror",
92+
WebError="weberror",
9393
ServiceWorker="serviceworker",
9494
Request="request",
9595
Response="response",
@@ -567,7 +567,7 @@ def _on_dialog(self, dialog: Dialog) -> None:
567567
asyncio.create_task(dialog.dismiss())
568568

569569
async def _on_page_error(self, error: Error, page: Optional[Page]) -> None:
570-
self.emit(BrowserContext.Events.PageError, PageError(self._loop, page, error))
570+
self.emit(BrowserContext.Events.WebError, WebError(self._loop, page, error))
571571
if page:
572572
page.emit(Page.Events.PageError, error)
573573

playwright/_impl/_js_handle.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,16 @@ def parse_value(value: Any, refs: Optional[Dict[int, Any]] = None) -> Any:
195195
if "bi" in value:
196196
return int(value["bi"])
197197

198+
if "m" in value:
199+
v = {}
200+
refs[value["m"]["id"]] = v
201+
return v
202+
203+
if "se" in value:
204+
v = set()
205+
refs[value["se"]["id"]] = v
206+
return v
207+
198208
if "a" in value:
199209
a: List = []
200210
refs[value["id"]] = a

playwright/_impl/_page_error.py renamed to playwright/_impl/_web_error.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from playwright._impl._page import Page
2020

2121

22-
class PageError:
22+
class WebError:
2323
def __init__(
2424
self, loop: AbstractEventLoop, page: Optional[Page], error: Error
2525
) -> None:

playwright/async_api/_generated.py

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@
7979
from playwright._impl._network import WebSocket as WebSocketImpl
8080
from playwright._impl._page import Page as PageImpl
8181
from playwright._impl._page import Worker as WorkerImpl
82-
from playwright._impl._page_error import PageError as PageErrorImpl
8382
from playwright._impl._playwright import Playwright as PlaywrightImpl
8483
from playwright._impl._selectors import Selectors as SelectorsImpl
8584
from playwright._impl._tracing import Tracing as TracingImpl
8685
from playwright._impl._video import Video as VideoImpl
86+
from playwright._impl._web_error import WebError as WebErrorImpl
8787

8888

8989
class Request(AsyncBase):
@@ -1302,6 +1302,9 @@ async def insert_text(self, text: str) -> None:
13021302
async def type(self, text: str, *, delay: typing.Optional[float] = None) -> None:
13031303
"""Keyboard.type
13041304

1305+
**NOTE** In most cases, you should use `locator.fill()` instead. You only need to press keys one by one if
1306+
there is special keyboard handling on the page - in this case use `locator.press_sequentially()`.
1307+
13051308
Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text.
13061309

13071310
To press a special key, like `Control` or `ArrowDown`, use `keyboard.press()`.
@@ -1337,6 +1340,8 @@ async def type(self, text: str, *, delay: typing.Optional[float] = None) -> None
13371340
async def press(self, key: str, *, delay: typing.Optional[float] = None) -> None:
13381341
"""Keyboard.press
13391342

1343+
**NOTE** In most cases, you should use `locator.press()` instead.
1344+
13401345
`key` can specify the intended
13411346
[keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) value or a single character
13421347
to generate the text for. A superset of the `key` values can be found
@@ -2335,7 +2340,7 @@ async def fill(
23352340
[control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be filled
23362341
instead.
23372342

2338-
To send fine-grained keyboard events, use `keyboard.type()`.
2343+
To send fine-grained keyboard events, use `locator.press_sequentially()`.
23392344

23402345
Parameters
23412346
----------
@@ -4633,7 +4638,7 @@ async def fill(
46334638
[control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be filled
46344639
instead.
46354640

4636-
To send fine-grained keyboard events, use `frame.type()`.
4641+
To send fine-grained keyboard events, use `locator.press_sequentially()`.
46374642

46384643
Parameters
46394644
----------
@@ -10278,7 +10283,7 @@ async def fill(
1027810283
[control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be filled
1027910284
instead.
1028010285

10281-
To send fine-grained keyboard events, use `page.type()`.
10286+
To send fine-grained keyboard events, use `locator.press_sequentially()`.
1028210287

1028310288
Parameters
1028410289
----------
@@ -12484,10 +12489,10 @@ async def set_checked(
1248412489
mapping.register(PageImpl, Page)
1248512490

1248612491

12487-
class PageError(AsyncBase):
12492+
class WebError(AsyncBase):
1248812493
@property
1248912494
def page(self) -> typing.Optional["Page"]:
12490-
"""PageError.page
12495+
"""WebError.page
1249112496

1249212497
The page that produced this unhandled exception, if any.
1249312498

@@ -12499,7 +12504,7 @@ def page(self) -> typing.Optional["Page"]:
1249912504

1250012505
@property
1250112506
def error(self) -> "Error":
12502-
"""PageError.error
12507+
"""WebError.error
1250312508

1250412509
Unhandled error that was thrown.
1250512510

@@ -12510,7 +12515,7 @@ def error(self) -> "Error":
1251012515
return mapping.from_impl(self._impl_obj.error)
1251112516

1251212517

12513-
mapping.register(PageErrorImpl, PageError)
12518+
mapping.register(WebErrorImpl, WebError)
1251412519

1251512520

1251612521
class BrowserContext(AsyncContextManager):
@@ -12639,12 +12644,12 @@ def on(
1263912644
@typing.overload
1264012645
def on(
1264112646
self,
12642-
event: Literal["pageerror"],
12643-
f: typing.Callable[["PageError"], "typing.Union[typing.Awaitable[None], None]"],
12647+
event: Literal["weberror"],
12648+
f: typing.Callable[["WebError"], "typing.Union[typing.Awaitable[None], None]"],
1264412649
) -> None:
1264512650
"""
12646-
Emitted when unhandled exceptions occur on any pages created through this context. To only listen for `pageError`
12647-
events from a particular page, use `page.on('page_error')`."""
12651+
Emitted when exception is unhandled in any of the pages in this context. To listen for errors from a particular
12652+
page, use `page.on('page_error')` instead."""
1264812653

1264912654
@typing.overload
1265012655
def on(
@@ -12838,12 +12843,12 @@ def once(
1283812843
@typing.overload
1283912844
def once(
1284012845
self,
12841-
event: Literal["pageerror"],
12842-
f: typing.Callable[["PageError"], "typing.Union[typing.Awaitable[None], None]"],
12846+
event: Literal["weberror"],
12847+
f: typing.Callable[["WebError"], "typing.Union[typing.Awaitable[None], None]"],
1284312848
) -> None:
1284412849
"""
12845-
Emitted when unhandled exceptions occur on any pages created through this context. To only listen for `pageError`
12846-
events from a particular page, use `page.on('page_error')`."""
12850+
Emitted when exception is unhandled in any of the pages in this context. To listen for errors from a particular
12851+
page, use `page.on('page_error')` instead."""
1284712852

1284812853
@typing.overload
1284912854
def once(

playwright/sync_api/_generated.py

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@
7373
from playwright._impl._network import WebSocket as WebSocketImpl
7474
from playwright._impl._page import Page as PageImpl
7575
from playwright._impl._page import Worker as WorkerImpl
76-
from playwright._impl._page_error import PageError as PageErrorImpl
7776
from playwright._impl._playwright import Playwright as PlaywrightImpl
7877
from playwright._impl._selectors import Selectors as SelectorsImpl
7978
from playwright._impl._sync_base import (
@@ -84,6 +83,7 @@
8483
)
8584
from playwright._impl._tracing import Tracing as TracingImpl
8685
from playwright._impl._video import Video as VideoImpl
86+
from playwright._impl._web_error import WebError as WebErrorImpl
8787

8888

8989
class Request(SyncBase):
@@ -1300,6 +1300,9 @@ def insert_text(self, text: str) -> None:
13001300
def type(self, text: str, *, delay: typing.Optional[float] = None) -> None:
13011301
"""Keyboard.type
13021302

1303+
**NOTE** In most cases, you should use `locator.fill()` instead. You only need to press keys one by one if
1304+
there is special keyboard handling on the page - in this case use `locator.press_sequentially()`.
1305+
13031306
Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text.
13041307

13051308
To press a special key, like `Control` or `ArrowDown`, use `keyboard.press()`.
@@ -1335,6 +1338,8 @@ def type(self, text: str, *, delay: typing.Optional[float] = None) -> None:
13351338
def press(self, key: str, *, delay: typing.Optional[float] = None) -> None:
13361339
"""Keyboard.press
13371340

1341+
**NOTE** In most cases, you should use `locator.press()` instead.
1342+
13381343
`key` can specify the intended
13391344
[keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) value or a single character
13401345
to generate the text for. A superset of the `key` values can be found
@@ -2353,7 +2358,7 @@ def fill(
23532358
[control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be filled
23542359
instead.
23552360

2356-
To send fine-grained keyboard events, use `keyboard.type()`.
2361+
To send fine-grained keyboard events, use `locator.press_sequentially()`.
23572362

23582363
Parameters
23592364
----------
@@ -4721,7 +4726,7 @@ def fill(
47214726
[control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be filled
47224727
instead.
47234728

4724-
To send fine-grained keyboard events, use `frame.type()`.
4729+
To send fine-grained keyboard events, use `locator.press_sequentially()`.
47254730

47264731
Parameters
47274732
----------
@@ -10354,7 +10359,7 @@ def fill(
1035410359
[control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be filled
1035510360
instead.
1035610361

10357-
To send fine-grained keyboard events, use `page.type()`.
10362+
To send fine-grained keyboard events, use `locator.press_sequentially()`.
1035810363

1035910364
Parameters
1036010365
----------
@@ -12594,10 +12599,10 @@ def set_checked(
1259412599
mapping.register(PageImpl, Page)
1259512600

1259612601

12597-
class PageError(SyncBase):
12602+
class WebError(SyncBase):
1259812603
@property
1259912604
def page(self) -> typing.Optional["Page"]:
12600-
"""PageError.page
12605+
"""WebError.page
1260112606

1260212607
The page that produced this unhandled exception, if any.
1260312608

@@ -12609,7 +12614,7 @@ def page(self) -> typing.Optional["Page"]:
1260912614

1261012615
@property
1261112616
def error(self) -> "Error":
12612-
"""PageError.error
12617+
"""WebError.error
1261312618

1261412619
Unhandled error that was thrown.
1261512620

@@ -12620,7 +12625,7 @@ def error(self) -> "Error":
1262012625
return mapping.from_impl(self._impl_obj.error)
1262112626

1262212627

12623-
mapping.register(PageErrorImpl, PageError)
12628+
mapping.register(WebErrorImpl, WebError)
1262412629

1262512630

1262612631
class BrowserContext(SyncContextManager):
@@ -12732,11 +12737,11 @@ def on(self, event: Literal["page"], f: typing.Callable[["Page"], "None"]) -> No
1273212737

1273312738
@typing.overload
1273412739
def on(
12735-
self, event: Literal["pageerror"], f: typing.Callable[["PageError"], "None"]
12740+
self, event: Literal["weberror"], f: typing.Callable[["WebError"], "None"]
1273612741
) -> None:
1273712742
"""
12738-
Emitted when unhandled exceptions occur on any pages created through this context. To only listen for `pageError`
12739-
events from a particular page, use `page.on('page_error')`."""
12743+
Emitted when exception is unhandled in any of the pages in this context. To listen for errors from a particular
12744+
page, use `page.on('page_error')` instead."""
1274012745

1274112746
@typing.overload
1274212747
def on(
@@ -12901,11 +12906,11 @@ def once(
1290112906

1290212907
@typing.overload
1290312908
def once(
12904-
self, event: Literal["pageerror"], f: typing.Callable[["PageError"], "None"]
12909+
self, event: Literal["weberror"], f: typing.Callable[["WebError"], "None"]
1290512910
) -> None:
1290612911
"""
12907-
Emitted when unhandled exceptions occur on any pages created through this context. To only listen for `pageError`
12908-
events from a particular page, use `page.on('page_error')`."""
12912+
Emitted when exception is unhandled in any of the pages in this context. To listen for errors from a particular
12913+
page, use `page.on('page_error')` instead."""
1290912914

1291012915
@typing.overload
1291112916
def once(

scripts/generate_api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@
5151
from playwright._impl._locator import FrameLocator, Locator
5252
from playwright._impl._network import Request, Response, Route, WebSocket
5353
from playwright._impl._page import Page, Worker
54-
from playwright._impl._page_error import PageError
5554
from playwright._impl._playwright import Playwright
5655
from playwright._impl._selectors import Selectors
5756
from playwright._impl._tracing import Tracing
5857
from playwright._impl._video import Video
58+
from playwright._impl._web_error import WebError
5959

6060

6161
def process_type(value: Any, param: bool = False) -> str:
@@ -240,7 +240,7 @@ def return_value(value: Any) -> List[str]:
240240
from playwright._impl._js_handle import JSHandle as JSHandleImpl
241241
from playwright._impl._network import Request as RequestImpl, Response as ResponseImpl, Route as RouteImpl, WebSocket as WebSocketImpl
242242
from playwright._impl._page import Page as PageImpl, Worker as WorkerImpl
243-
from playwright._impl._page_error import PageError as PageErrorImpl
243+
from playwright._impl._web_error import WebError as WebErrorImpl
244244
from playwright._impl._playwright import Playwright as PlaywrightImpl
245245
from playwright._impl._selectors import Selectors as SelectorsImpl
246246
from playwright._impl._video import Video as VideoImpl
@@ -273,7 +273,7 @@ def return_value(value: Any) -> List[str]:
273273
Download,
274274
Video,
275275
Page,
276-
PageError,
276+
WebError,
277277
BrowserContext,
278278
CDPSession,
279279
Browser,

setup.py

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

33-
driver_version = "1.38.0-alpha-sep-4-2023"
33+
driver_version = "1.38.0"
3434

3535

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

tests/async/test_browsercontext_events.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ async def test_console_event_should_work_with_context_manager(page: Page) -> Non
191191

192192

193193
async def test_page_error_event_should_work(page: Page) -> None:
194-
async with page.context.expect_event("pageerror") as page_error_info:
194+
async with page.context.expect_event("weberror") as page_error_info:
195195
await page.set_content('<script>throw new Error("boom")</script>')
196196
page_error = await page_error_info.value
197197
assert page_error.page == page

tests/async/test_evaluate.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,14 @@ async def test_evaluate_transfer_bigint(page: Page) -> None:
6969
assert await page.evaluate("a => a", 17) == 17
7070

7171

72+
async def test_should_transfer_maps(page):
73+
assert await page.evaluate("() => new Map([[1, { test: 42n }]])") == {}
74+
75+
76+
async def test_should_transfer_sets(page):
77+
assert await page.evaluate("() => new Set([1, { test: 42n }])") == set()
78+
79+
7280
async def test_evaluate_return_undefined_for_objects_with_symbols(page):
7381
assert await page.evaluate('[Symbol("foo4")]') == [None]
7482
assert (

0 commit comments

Comments
 (0)