From 40489cfd7b2450eadb69f5736f6702a214e21336 Mon Sep 17 00:00:00 2001
From: "microsoft-playwright-automation[bot]"
<203992400+microsoft-playwright-automation[bot]@users.noreply.github.com>
Date: Fri, 14 Nov 2025 10:10:45 +0000
Subject: [PATCH] feat(roll): roll to ToT Playwright (14-11-25)
---
dotnet/docs/api/class-consolemessage.mdx | 17 ++++++
dotnet/docs/api/class-frame.mdx | 3 ++
dotnet/docs/api/class-locator.mdx | 3 ++
dotnet/docs/api/class-page.mdx | 3 ++
dotnet/docs/api/class-worker.mdx | 17 ++++++
java/docs/api/class-consolemessage.mdx | 17 ++++++
java/docs/api/class-frame.mdx | 3 ++
java/docs/api/class-locator.mdx | 3 ++
java/docs/api/class-page.mdx | 3 ++
java/docs/api/class-worker.mdx | 17 ++++++
nodejs/docs/api/class-consolemessage.mdx | 17 ++++++
nodejs/docs/api/class-frame.mdx | 3 ++
nodejs/docs/api/class-locator.mdx | 3 ++
nodejs/docs/api/class-page.mdx | 3 ++
nodejs/docs/api/class-testconfig.mdx | 6 +--
nodejs/docs/api/class-worker.mdx | 55 +++++++++++++++++++
nodejs/docs/test-assertions.mdx | 23 +++++---
python/docs/api/class-consolemessage.mdx | 17 ++++++
python/docs/api/class-frame.mdx | 3 ++
python/docs/api/class-locator.mdx | 3 ++
python/docs/api/class-page.mdx | 3 ++
python/docs/api/class-worker.mdx | 69 ++++++++++++++++++++++++
22 files changed, 280 insertions(+), 11 deletions(-)
diff --git a/dotnet/docs/api/class-consolemessage.mdx b/dotnet/docs/api/class-consolemessage.mdx
index 734f9554fbf..5c26fa33df7 100644
--- a/dotnet/docs/api/class-consolemessage.mdx
+++ b/dotnet/docs/api/class-consolemessage.mdx
@@ -117,6 +117,23 @@ ConsoleMessage.Type
**Returns**
- [string]#
+---
+
+### Worker {#console-message-worker}
+
+Added in: v1.57consoleMessage.Worker
+
+The web worker or service worker that produced this console message, if any. Note that console messages from web workers also have non-null [ConsoleMessage.Page](/api/class-consolemessage.mdx#console-message-page).
+
+**Usage**
+
+```csharp
+ConsoleMessage.Worker
+```
+
+**Returns**
+- [Worker]?#
+
[APIRequest]: /api/class-apirequest.mdx "APIRequest"
[APIRequestContext]: /api/class-apirequestcontext.mdx "APIRequestContext"
diff --git a/dotnet/docs/api/class-frame.mdx b/dotnet/docs/api/class-frame.mdx
index 5403f14750d..bc77f685fe8 100644
--- a/dotnet/docs/api/class-frame.mdx
+++ b/dotnet/docs/api/class-frame.mdx
@@ -181,6 +181,9 @@ await Frame.DragAndDropAsync(source, target, options);
Clicks on the source element at this point relative to the top-left corner of the element's padding box. If not specified, some visible point of the element is used.
+ - `Steps` [int]? *(optional)* Added in: v1.57#
+
+ Defaults to 1. Sends `n` interpolated `mousemove` events to represent travel between the `mousedown` and `mouseup` of the drag. When set to 1, emits a single `mousemove` event at the destination location.
- `Strict` [bool]? *(optional)* Added in: v1.14#
When true, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception.
diff --git a/dotnet/docs/api/class-locator.mdx b/dotnet/docs/api/class-locator.mdx
index aa2142b0fbe..3126ed6cdb1 100644
--- a/dotnet/docs/api/class-locator.mdx
+++ b/dotnet/docs/api/class-locator.mdx
@@ -674,6 +674,9 @@ await source.DragToAsync(target, new()
Clicks on the source element at this point relative to the top-left corner of the element's padding box. If not specified, some visible point of the element is used.
+ - `Steps` [int]? *(optional)* Added in: v1.57#
+
+ Defaults to 1. Sends `n` interpolated `mousemove` events to represent travel between the `mousedown` and `mouseup` of the drag. When set to 1, emits a single `mousemove` event at the destination location.
- `TargetPosition` TargetPosition? *(optional)*#
- `X` [float]
diff --git a/dotnet/docs/api/class-page.mdx b/dotnet/docs/api/class-page.mdx
index fcc0260d1c0..dfd0418fa99 100644
--- a/dotnet/docs/api/class-page.mdx
+++ b/dotnet/docs/api/class-page.mdx
@@ -390,6 +390,9 @@ await Page.DragAndDropAsync("#source", "#target", new()
Clicks on the source element at this point relative to the top-left corner of the element's padding box. If not specified, some visible point of the element is used.
+ - `Steps` [int]? *(optional)* Added in: v1.57#
+
+ Defaults to 1. Sends `n` interpolated `mousemove` events to represent travel between the `mousedown` and `mouseup` of the drag. When set to 1, emits a single `mousemove` event at the destination location.
- `Strict` [bool]? *(optional)* Added in: v1.14#
When true, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception.
diff --git a/dotnet/docs/api/class-worker.mdx b/dotnet/docs/api/class-worker.mdx
index e728143a4b7..1e7bfe2247d 100644
--- a/dotnet/docs/api/class-worker.mdx
+++ b/dotnet/docs/api/class-worker.mdx
@@ -118,6 +118,23 @@ Worker.Close += async (_, worker) => {};
**Event data**
- [Worker]
+---
+
+### event Console {#worker-event-console}
+
+Added in: v1.57worker.event Console
+
+Emitted when JavaScript within the worker calls one of console API methods, e.g. `console.log` or `console.dir`.
+
+**Usage**
+
+```csharp
+Worker.Console += async (_, consoleMessage) => {};
+```
+
+**Event data**
+- [ConsoleMessage]
+
[APIRequest]: /api/class-apirequest.mdx "APIRequest"
[APIRequestContext]: /api/class-apirequestcontext.mdx "APIRequestContext"
diff --git a/java/docs/api/class-consolemessage.mdx b/java/docs/api/class-consolemessage.mdx
index a545927a9ef..b614793046a 100644
--- a/java/docs/api/class-consolemessage.mdx
+++ b/java/docs/api/class-consolemessage.mdx
@@ -118,6 +118,23 @@ ConsoleMessage.type();
**Returns**
- [String]#
+---
+
+### worker {#console-message-worker}
+
+Added in: v1.57consoleMessage.worker
+
+The web worker or service worker that produced this console message, if any. Note that console messages from web workers also have non-null [ConsoleMessage.page()](/api/class-consolemessage.mdx#console-message-page).
+
+**Usage**
+
+```java
+ConsoleMessage.worker();
+```
+
+**Returns**
+- [null] | [Worker]#
+
[APIRequest]: /api/class-apirequest.mdx "APIRequest"
[APIRequestContext]: /api/class-apirequestcontext.mdx "APIRequestContext"
diff --git a/java/docs/api/class-frame.mdx b/java/docs/api/class-frame.mdx
index c33a3ae8564..21df4c2b509 100644
--- a/java/docs/api/class-frame.mdx
+++ b/java/docs/api/class-frame.mdx
@@ -181,6 +181,9 @@ Frame.dragAndDrop(source, target, options);
Clicks on the source element at this point relative to the top-left corner of the element's padding box. If not specified, some visible point of the element is used.
+ - `setSteps` [int] *(optional)* Added in: v1.57#
+
+ Defaults to 1. Sends `n` interpolated `mousemove` events to represent travel between the `mousedown` and `mouseup` of the drag. When set to 1, emits a single `mousemove` event at the destination location.
- `setStrict` [boolean] *(optional)* Added in: v1.14#
When true, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception.
diff --git a/java/docs/api/class-locator.mdx b/java/docs/api/class-locator.mdx
index 1bad5683427..580a413b7e0 100644
--- a/java/docs/api/class-locator.mdx
+++ b/java/docs/api/class-locator.mdx
@@ -671,6 +671,9 @@ source.dragTo(target, new Locator.DragToOptions()
Clicks on the source element at this point relative to the top-left corner of the element's padding box. If not specified, some visible point of the element is used.
+ - `setSteps` [int] *(optional)* Added in: v1.57#
+
+ Defaults to 1. Sends `n` interpolated `mousemove` events to represent travel between the `mousedown` and `mouseup` of the drag. When set to 1, emits a single `mousemove` event at the destination location.
- `setTargetPosition` TargetPosition *(optional)*#
- `setX` [double]
diff --git a/java/docs/api/class-page.mdx b/java/docs/api/class-page.mdx
index bc730ea383c..926fd8ed5d0 100644
--- a/java/docs/api/class-page.mdx
+++ b/java/docs/api/class-page.mdx
@@ -391,6 +391,9 @@ page.dragAndDrop("#source", "#target", new Page.DragAndDropOptions()
Clicks on the source element at this point relative to the top-left corner of the element's padding box. If not specified, some visible point of the element is used.
+ - `setSteps` [int] *(optional)* Added in: v1.57#
+
+ Defaults to 1. Sends `n` interpolated `mousemove` events to represent travel between the `mousedown` and `mouseup` of the drag. When set to 1, emits a single `mousemove` event at the destination location.
- `setStrict` [boolean] *(optional)* Added in: v1.14#
When true, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception.
diff --git a/java/docs/api/class-worker.mdx b/java/docs/api/class-worker.mdx
index f387780e844..db74ebe8fb8 100644
--- a/java/docs/api/class-worker.mdx
+++ b/java/docs/api/class-worker.mdx
@@ -143,6 +143,23 @@ Worker.onClose(handler)
**Event data**
- [Worker]
+---
+
+### onConsole(handler) {#worker-event-console}
+
+Added in: v1.57worker.onConsole(handler)
+
+Emitted when JavaScript within the worker calls one of console API methods, e.g. `console.log` or `console.dir`.
+
+**Usage**
+
+```java
+Worker.onConsole(handler)
+```
+
+**Event data**
+- [ConsoleMessage]
+
[APIRequest]: /api/class-apirequest.mdx "APIRequest"
[APIRequestContext]: /api/class-apirequestcontext.mdx "APIRequestContext"
diff --git a/nodejs/docs/api/class-consolemessage.mdx b/nodejs/docs/api/class-consolemessage.mdx
index b200c113d53..508766af369 100644
--- a/nodejs/docs/api/class-consolemessage.mdx
+++ b/nodejs/docs/api/class-consolemessage.mdx
@@ -124,6 +124,23 @@ consoleMessage.type();
**Returns**
- "log" | "debug" | "info" | "error" | "warning" | "dir" | "dirxml" | "table" | "trace" | "clear" | "startGroup" | "startGroupCollapsed" | "endGroup" | "assert" | "profile" | "profileEnd" | "count" | "timeEnd"#
+---
+
+### worker {#console-message-worker}
+
+Added in: v1.57consoleMessage.worker
+
+The web worker or service worker that produced this console message, if any. Note that console messages from web workers also have non-null [consoleMessage.page()](/api/class-consolemessage.mdx#console-message-page).
+
+**Usage**
+
+```js
+consoleMessage.worker();
+```
+
+**Returns**
+- [null] | [Worker]#
+
[Android]: /api/class-android.mdx "Android"
[AndroidDevice]: /api/class-androiddevice.mdx "AndroidDevice"
diff --git a/nodejs/docs/api/class-frame.mdx b/nodejs/docs/api/class-frame.mdx
index 8cb4ad43c84..6e8c9f484b8 100644
--- a/nodejs/docs/api/class-frame.mdx
+++ b/nodejs/docs/api/class-frame.mdx
@@ -176,6 +176,9 @@ await frame.dragAndDrop(source, target, options);
Clicks on the source element at this point relative to the top-left corner of the element's padding box. If not specified, some visible point of the element is used.
+ - `steps` [number] *(optional)* Added in: v1.57#
+
+ Defaults to 1. Sends `n` interpolated `mousemove` events to represent travel between the `mousedown` and `mouseup` of the drag. When set to 1, emits a single `mousemove` event at the destination location.
- `strict` [boolean] *(optional)* Added in: v1.14#
When true, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception.
diff --git a/nodejs/docs/api/class-locator.mdx b/nodejs/docs/api/class-locator.mdx
index 341eb2f8ccc..623712ee783 100644
--- a/nodejs/docs/api/class-locator.mdx
+++ b/nodejs/docs/api/class-locator.mdx
@@ -672,6 +672,9 @@ await source.dragTo(target, {
Clicks on the source element at this point relative to the top-left corner of the element's padding box. If not specified, some visible point of the element is used.
+ - `steps` [number] *(optional)* Added in: v1.57#
+
+ Defaults to 1. Sends `n` interpolated `mousemove` events to represent travel between the `mousedown` and `mouseup` of the drag. When set to 1, emits a single `mousemove` event at the destination location.
- `targetPosition` [Object] *(optional)*#
- `x` [number]
diff --git a/nodejs/docs/api/class-page.mdx b/nodejs/docs/api/class-page.mdx
index 98c0fcf0a2e..2d070378d07 100644
--- a/nodejs/docs/api/class-page.mdx
+++ b/nodejs/docs/api/class-page.mdx
@@ -403,6 +403,9 @@ await page.dragAndDrop('#source', '#target', {
Clicks on the source element at this point relative to the top-left corner of the element's padding box. If not specified, some visible point of the element is used.
+ - `steps` [number] *(optional)* Added in: v1.57#
+
+ Defaults to 1. Sends `n` interpolated `mousemove` events to represent travel between the `mousedown` and `mouseup` of the drag. When set to 1, emits a single `mousemove` event at the destination location.
- `strict` [boolean] *(optional)* Added in: v1.14#
When true, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception.
diff --git a/nodejs/docs/api/class-testconfig.mdx b/nodejs/docs/api/class-testconfig.mdx
index f3a6f5abf5e..3fb00df1356 100644
--- a/nodejs/docs/api/class-testconfig.mdx
+++ b/nodejs/docs/api/class-testconfig.mdx
@@ -1110,14 +1110,14 @@ export default defineConfig({
- `wait` [Object] *(optional)*
- `stdout` [RegExp] *(optional)*
-
+ Regular expression to wait for in the `stdout` of the command output. Named capture groups are stored in the environment, for example `/Listening on port (?\\d+)/` will store the port number in `process.env['MY_SERVER_PORT']`.
- `stderr` [RegExp] *(optional)*
-
+ Regular expression to wait for in the `stderr` of the command output. Named capture groups are stored in the environment, for example `/Listening on port (?\\d+)/` will store the port number in `process.env['MY_SERVER_PORT']`.
- `time` [number] *(optional)*
- Consider command started only when given output has been produced or a time in milliseconds has passed.
+ Consider command started only when given output has been produced.
- `timeout` [number] *(optional)*
How long to wait for the process to start up and be available in milliseconds. Defaults to 60000.
diff --git a/nodejs/docs/api/class-worker.mdx b/nodejs/docs/api/class-worker.mdx
index 8932c2c2c42..702f80b884c 100644
--- a/nodejs/docs/api/class-worker.mdx
+++ b/nodejs/docs/api/class-worker.mdx
@@ -100,6 +100,44 @@ worker.url();
---
+### waitForEvent {#worker-wait-for-event}
+
+Added in: v1.57worker.waitForEvent
+
+Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy value. Will throw an error if the page is closed before the event is fired. Returns the event data value.
+
+**Usage**
+
+```js
+// Start waiting for download before clicking. Note no await.
+const consolePromise = worker.waitForEvent('console');
+await worker.evaluate('console.log(42)');
+const consoleMessage = await consolePromise;
+```
+
+**Arguments**
+- `event` [string]#
+
+ Event name, same one typically passed into `*.on(event)`.
+- `optionsOrPredicate` [function] | [Object] *(optional)*#
+ - `predicate` [function]
+
+ Receives the event data and resolves to truthy value when the waiting should resolve.
+ - `timeout` [number] *(optional)*
+
+ Maximum time to wait for in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `actionTimeout` option in the config, or by using the [browserContext.setDefaultTimeout()](/api/class-browsercontext.mdx#browser-context-set-default-timeout) or [page.setDefaultTimeout()](/api/class-page.mdx#page-set-default-timeout) methods.
+
+ Either a predicate that receives an event or an options object. Optional.
+- `options` [Object] *(optional)*
+ - `predicate` [function] *(optional)*#
+
+ Receives the event data and resolves to truthy value when the waiting should resolve.
+
+**Returns**
+- [Promise]<[Object]>#
+
+---
+
## Events
### on('close') {#worker-event-close}
@@ -117,6 +155,23 @@ worker.on('close', data => {});
**Event data**
- [Worker]
+---
+
+### on('console') {#worker-event-console}
+
+Added in: v1.57worker.on('console')
+
+Emitted when JavaScript within the worker calls one of console API methods, e.g. `console.log` or `console.dir`.
+
+**Usage**
+
+```js
+worker.on('console', data => {});
+```
+
+**Event data**
+- [ConsoleMessage]
+
[Android]: /api/class-android.mdx "Android"
[AndroidDevice]: /api/class-androiddevice.mdx "AndroidDevice"
diff --git a/nodejs/docs/test-assertions.mdx b/nodejs/docs/test-assertions.mdx
index f1a7efd92a1..631f1f34bb8 100644
--- a/nodejs/docs/test-assertions.mdx
+++ b/nodejs/docs/test-assertions.mdx
@@ -92,14 +92,21 @@ Prefer [auto-retrying](#auto-retrying-assertions) assertions whenever possible.
| [expect(value).toMatchObject()](/api/class-genericassertions.mdx#generic-assertions-to-match-object) | Object contains specified properties |
| [expect(value).toStrictEqual()](/api/class-genericassertions.mdx#generic-assertions-to-strict-equal) | Value is similar, including property types |
| [expect(value).toThrow()](/api/class-genericassertions.mdx#generic-assertions-to-throw) | Function throws an error |
-| [expect(value).any()](/api/class-genericassertions.mdx#generic-assertions-any) | Matches any instance of a class/primitive |
-| [expect(value).anything()](/api/class-genericassertions.mdx#generic-assertions-anything) | Matches anything |
-| [expect(value).arrayContaining()](/api/class-genericassertions.mdx#generic-assertions-array-containing) | Array contains specific elements |
-| [expect(value).arrayOf()](/api/class-genericassertions.mdx#generic-assertions-array-of) | Array contains elements of specific type |
-| [expect(value).closeTo()](/api/class-genericassertions.mdx#generic-assertions-close-to) | Number is approximately equal |
-| [expect(value).objectContaining()](/api/class-genericassertions.mdx#generic-assertions-object-containing) | Object contains specific properties |
-| [expect(value).stringContaining()](/api/class-genericassertions.mdx#generic-assertions-string-containing) | String contains a substring |
-| [expect(value).stringMatching()](/api/class-genericassertions.mdx#generic-assertions-string-matching) | String matches a regular expression |
+
+## Asymmetric matchers
+
+These expressions can be nested in other assertions to allow more relaxed matching against a given condition.
+
+| Matcher | Description |
+| :- | :- |
+| [expect.any()](./api/class-genericassertions.mdx#generic-assertions-any) | Matches any instance of a class/primitive |
+| [expect.anything()](./api/class-genericassertions.mdx#generic-assertions-anything) | Matches anything |
+| [expect.arrayContaining()](./api/class-genericassertions.mdx#generic-assertions-array-containing) | Array contains specific elements |
+| [expect.arrayOf()](./api/class-genericassertions.mdx#generic-assertions-array-of) | Array contains elements of specific type |
+| [expect.closeTo()](./api/class-genericassertions.mdx#generic-assertions-close-to) | Number is approximately equal |
+| [expect.objectContaining()](./api/class-genericassertions.mdx#generic-assertions-object-containing) | Object contains specific properties |
+| [expect.stringContaining()](./api/class-genericassertions.mdx#generic-assertions-string-containing) | String contains a substring |
+| [expect.stringMatching()](./api/class-genericassertions.mdx#generic-assertions-string-matching) | String matches a regular expression |
## Negating matchers
diff --git a/python/docs/api/class-consolemessage.mdx b/python/docs/api/class-consolemessage.mdx
index f30e1b5c57b..6996f8f1cb6 100644
--- a/python/docs/api/class-consolemessage.mdx
+++ b/python/docs/api/class-consolemessage.mdx
@@ -154,6 +154,23 @@ console_message.type
**Returns**
- "log" | "debug" | "info" | "error" | "warning" | "dir" | "dirxml" | "table" | "trace" | "clear" | "startGroup" | "startGroupCollapsed" | "endGroup" | "assert" | "profile" | "profileEnd" | "count" | "timeEnd"#
+---
+
+### worker {#console-message-worker}
+
+Added in: v1.57consoleMessage.worker
+
+The web worker or service worker that produced this console message, if any. Note that console messages from web workers also have non-null [console_message.page](/api/class-consolemessage.mdx#console-message-page).
+
+**Usage**
+
+```python
+console_message.worker
+```
+
+**Returns**
+- [NoneType] | [Worker]#
+
[APIRequest]: /api/class-apirequest.mdx "APIRequest"
[APIRequestContext]: /api/class-apirequestcontext.mdx "APIRequestContext"
diff --git a/python/docs/api/class-frame.mdx b/python/docs/api/class-frame.mdx
index 2419a1cb5a5..d35cd35dd80 100644
--- a/python/docs/api/class-frame.mdx
+++ b/python/docs/api/class-frame.mdx
@@ -199,6 +199,9 @@ frame.drag_and_drop(source, target, **kwargs)
Clicks on the source element at this point relative to the top-left corner of the element's padding box. If not specified, some visible point of the element is used.
+- `steps` [int] *(optional)* Added in: v1.57#
+
+ Defaults to 1. Sends `n` interpolated `mousemove` events to represent travel between the `mousedown` and `mouseup` of the drag. When set to 1, emits a single `mousemove` event at the destination location.
- `strict` [bool] *(optional)* Added in: v1.14#
When true, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception.
diff --git a/python/docs/api/class-locator.mdx b/python/docs/api/class-locator.mdx
index b59aa848b2a..dcdf23e3e02 100644
--- a/python/docs/api/class-locator.mdx
+++ b/python/docs/api/class-locator.mdx
@@ -932,6 +932,9 @@ await source.drag_to(
Clicks on the source element at this point relative to the top-left corner of the element's padding box. If not specified, some visible point of the element is used.
+- `steps` [int] *(optional)* Added in: v1.57#
+
+ Defaults to 1. Sends `n` interpolated `mousemove` events to represent travel between the `mousedown` and `mouseup` of the drag. When set to 1, emits a single `mousemove` event at the destination location.
- `target_position` [Dict] *(optional)*#
- `x` [float]
diff --git a/python/docs/api/class-page.mdx b/python/docs/api/class-page.mdx
index 295c829fdee..4e8c46c863f 100644
--- a/python/docs/api/class-page.mdx
+++ b/python/docs/api/class-page.mdx
@@ -560,6 +560,9 @@ await page.drag_and_drop(
Clicks on the source element at this point relative to the top-left corner of the element's padding box. If not specified, some visible point of the element is used.
+- `steps` [int] *(optional)* Added in: v1.57#
+
+ Defaults to 1. Sends `n` interpolated `mousemove` events to represent travel between the `mousedown` and `mouseup` of the drag. When set to 1, emits a single `mousemove` event at the destination location.
- `strict` [bool] *(optional)* Added in: v1.14#
When true, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception.
diff --git a/python/docs/api/class-worker.mdx b/python/docs/api/class-worker.mdx
index 20cec2e290d..5b316bf7da1 100644
--- a/python/docs/api/class-worker.mdx
+++ b/python/docs/api/class-worker.mdx
@@ -86,6 +86,58 @@ worker.evaluate_handle(expression, **kwargs)
---
+### expect_event {#worker-wait-for-event}
+
+Added in: v1.57worker.expect_event
+
+Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy value. Will throw an error if the page is closed before the event is fired. Returns the event data value.
+
+**Usage**
+
+
+
+
+```py
+with worker.expect_event("console") as event_info:
+ worker.evaluate("console.log(42)")
+message = event_info.value
+```
+
+
+
+
+```py
+async with worker.expect_event("console") as event_info:
+ await worker.evaluate("console.log(42)")
+message = await event_info.value
+```
+
+
+
+
+**Arguments**
+- `event` [str]#
+
+ Event name, same one typically passed into `*.on(event)`.
+- `predicate` [Callable] *(optional)*#
+
+ Receives the event data and resolves to truthy value when the waiting should resolve.
+- `timeout` [float] *(optional)*#
+
+ Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [browser_context.set_default_timeout()](/api/class-browsercontext.mdx#browser-context-set-default-timeout).
+
+**Returns**
+- [EventContextManager]#
+
+---
+
## Properties
### url {#worker-url}
@@ -120,6 +172,23 @@ worker.on("close", handler)
**Event data**
- [Worker]
+---
+
+### on("console") {#worker-event-console}
+
+Added in: v1.57worker.on("console")
+
+Emitted when JavaScript within the worker calls one of console API methods, e.g. `console.log` or `console.dir`.
+
+**Usage**
+
+```python
+worker.on("console", handler)
+```
+
+**Event data**
+- [ConsoleMessage]
+
[APIRequest]: /api/class-apirequest.mdx "APIRequest"
[APIRequestContext]: /api/class-apirequestcontext.mdx "APIRequestContext"