79
79
from playwright._impl._network import WebSocket as WebSocketImpl
80
80
from playwright._impl._page import Page as PageImpl
81
81
from playwright._impl._page import Worker as WorkerImpl
82
- from playwright._impl._page_error import PageError as PageErrorImpl
83
82
from playwright._impl._playwright import Playwright as PlaywrightImpl
84
83
from playwright._impl._selectors import Selectors as SelectorsImpl
85
84
from playwright._impl._tracing import Tracing as TracingImpl
86
85
from playwright._impl._video import Video as VideoImpl
86
+ from playwright._impl._web_error import WebError as WebErrorImpl
87
87
88
88
89
89
class Request(AsyncBase):
@@ -1302,6 +1302,9 @@ async def insert_text(self, text: str) -> None:
1302
1302
async def type(self, text: str, *, delay: typing.Optional[float] = None) -> None:
1303
1303
"""Keyboard.type
1304
1304
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
+
1305
1308
Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text.
1306
1309
1307
1310
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
1337
1340
async def press(self, key: str, *, delay: typing.Optional[float] = None) -> None:
1338
1341
"""Keyboard.press
1339
1342
1343
+ **NOTE** In most cases, you should use `locator.press()` instead.
1344
+
1340
1345
`key` can specify the intended
1341
1346
[keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) value or a single character
1342
1347
to generate the text for. A superset of the `key` values can be found
@@ -2335,7 +2340,7 @@ async def fill(
2335
2340
[control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be filled
2336
2341
instead.
2337
2342
2338
- To send fine-grained keyboard events, use `keyboard.type ()`.
2343
+ To send fine-grained keyboard events, use `locator.press_sequentially ()`.
2339
2344
2340
2345
Parameters
2341
2346
----------
@@ -4633,7 +4638,7 @@ async def fill(
4633
4638
[control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be filled
4634
4639
instead.
4635
4640
4636
- To send fine-grained keyboard events, use `frame.type ()`.
4641
+ To send fine-grained keyboard events, use `locator.press_sequentially ()`.
4637
4642
4638
4643
Parameters
4639
4644
----------
@@ -10278,7 +10283,7 @@ async def fill(
10278
10283
[control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be filled
10279
10284
instead.
10280
10285
10281
- To send fine-grained keyboard events, use `page.type ()`.
10286
+ To send fine-grained keyboard events, use `locator.press_sequentially ()`.
10282
10287
10283
10288
Parameters
10284
10289
----------
@@ -12484,10 +12489,10 @@ async def set_checked(
12484
12489
mapping.register(PageImpl, Page)
12485
12490
12486
12491
12487
- class PageError (AsyncBase):
12492
+ class WebError (AsyncBase):
12488
12493
@property
12489
12494
def page(self) -> typing.Optional["Page"]:
12490
- """PageError .page
12495
+ """WebError .page
12491
12496
12492
12497
The page that produced this unhandled exception, if any.
12493
12498
@@ -12499,7 +12504,7 @@ def page(self) -> typing.Optional["Page"]:
12499
12504
12500
12505
@property
12501
12506
def error(self) -> "Error":
12502
- """PageError .error
12507
+ """WebError .error
12503
12508
12504
12509
Unhandled error that was thrown.
12505
12510
@@ -12510,7 +12515,7 @@ def error(self) -> "Error":
12510
12515
return mapping.from_impl(self._impl_obj.error)
12511
12516
12512
12517
12513
- mapping.register(PageErrorImpl, PageError )
12518
+ mapping.register(WebErrorImpl, WebError )
12514
12519
12515
12520
12516
12521
class BrowserContext(AsyncContextManager):
@@ -12639,12 +12644,12 @@ def on(
12639
12644
@typing.overload
12640
12645
def on(
12641
12646
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]"],
12644
12649
) -> None:
12645
12650
"""
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 ."""
12648
12653
12649
12654
@typing.overload
12650
12655
def on(
@@ -12838,12 +12843,12 @@ def once(
12838
12843
@typing.overload
12839
12844
def once(
12840
12845
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]"],
12843
12848
) -> None:
12844
12849
"""
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 ."""
12847
12852
12848
12853
@typing.overload
12849
12854
def once(
0 commit comments