Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions java/docs/api/class-worker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,36 @@ Worker.waitForClose(callback, options);

---

### waitForConsoleMessage {#worker-wait-for-console-message}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.57</font><x-search>worker.waitForConsoleMessage</x-search>

Performs action and waits for a console message.

**Usage**

```java
Worker.waitForConsoleMessage(callback);
Worker.waitForConsoleMessage(callback, options);
```

**Arguments**
- `options` `Worker.WaitForConsoleMessageOptions` *(optional)*
- `setPredicate` [Predicate]&lt;[ConsoleMessage]&gt; *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="worker-wait-for-console-message-option-predicate"/><a href="#worker-wait-for-console-message-option-predicate" class="list-anchor">#</a>

Receives the [ConsoleMessage] object and resolves to true when the waiting should resolve.
- `setTimeout` [double] *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="worker-wait-for-console-message-option-timeout"/><a href="#worker-wait-for-console-message-option-timeout" class="list-anchor">#</a>

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 [BrowserContext.setDefaultTimeout()](/api/class-browsercontext.mdx#browser-context-set-default-timeout).
- `callback` [Runnable]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="worker-wait-for-console-message-option-callback"/><a href="#worker-wait-for-console-message-option-callback" class="list-anchor">#</a>

Callback that performs the action triggering the event.

**Returns**
- [ConsoleMessage]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="worker-wait-for-console-message-return"/><a href="#worker-wait-for-console-message-return" class="list-anchor">#</a>

---

## Events

### onClose(handler) {#worker-event-close}
Expand Down
2 changes: 1 addition & 1 deletion java/docs/locators.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ Locators can be filtered by text with the [Locator.filter()](/api/class-locator.
page.getByRole(AriaRole.LISTITEM)
.filter(new Locator.FilterOptions().setHasText("Product 2"))
.getByRole(AriaRole.BUTTON,
new Page.GetByRoleOptions().setName("Add to cart"))
new Locator.GetByRoleOptions().setName("Add to cart"))
.click();
```

Expand Down