Skip to content

Commit 4dbbb47

Browse files
authored
docs: document Python's expect_event methods (#4963)
1 parent e67d897 commit 4dbbb47

File tree

6 files changed

+347
-27
lines changed

6 files changed

+347
-27
lines changed

docs/src/api/class-frame.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -856,15 +856,7 @@ await frame.click('button'); // Click triggers navigation.
856856
await frame.waitForLoadState(); // Waits for 'load' state by default.
857857
```
858858

859-
### param: Frame.waitForLoadState.state
860-
- `state` <"load"|"domcontentloaded"|"networkidle">
861-
862-
Optional load state to wait for, defaults to `load`. If the state has been already reached while loading current document, the
863-
method returns immediately. Can be one of:
864-
* `'load'` - wait for the `load` event to be fired.
865-
* `'domcontentloaded'` - wait for the `DOMContentLoaded` event to be fired.
866-
* `'networkidle'` - wait until there are no network connections for at least `500` ms.
867-
859+
### param: Frame.waitForLoadState.state = %%-wait-for-load-state-state-%%
868860
### option: Frame.waitForLoadState.timeout = %%-navigation-timeout-%%
869861

870862
## async method: Frame.waitForNavigation

docs/src/api/class-page.md

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1608,10 +1608,7 @@ Returns the event data value.
16081608
Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy
16091609
value. Will throw an error if the page is closed before the event is fired.
16101610

1611-
### param: Page.waitForEvent.event
1612-
- `event` <[string]>
1613-
1614-
Event name, same one would pass into `page.on(event)`.
1611+
### param: Page.waitForEvent.event = %%-wait-for-event-event-%%
16151612

16161613
### param: Page.waitForEvent.optionsOrPredicate
16171614
* langs: js
@@ -1693,15 +1690,7 @@ console.log(await popup.title()); // Popup is ready to use.
16931690

16941691
Shortcut for main frame's [`method: Frame.waitForLoadState`].
16951692

1696-
### param: Page.waitForLoadState.state
1697-
- `state` <"load"|"domcontentloaded"|"networkidle">
1698-
1699-
Optional load state to wait for, defaults to `load`. If the state has been already reached while loading current document, the
1700-
method resolves immediately. Can be one of:
1701-
* `'load'` - wait for the `load` event to be fired.
1702-
* `'domcontentloaded'` - wait for the `DOMContentLoaded` event to be fired.
1703-
* `'networkidle'` - wait until there are no network connections for at least `500` ms.
1704-
1693+
### param: Page.waitForLoadState.state = %%-wait-for-load-state-state-%%
17051694
### option: Page.waitForLoadState.timeout = %%-navigation-timeout-%%
17061695

17071696
## async method: Page.waitForNavigation
@@ -1729,10 +1718,7 @@ Shortcut for main frame's [`method: Frame.waitForNavigation`].
17291718

17301719
### option: Page.waitForNavigation.timeout = %%-navigation-timeout-%%
17311720

1732-
### option: Page.waitForNavigation.url
1733-
- `url` <[string]|[RegExp]|[function]\([URL]\):[boolean]>
1734-
1735-
A glob pattern, regex pattern or predicate receiving [URL] to match while waiting for the navigation.
1721+
### option: Page.waitForNavigation.url = %%-wait-for-navigation-url-%%
17361722

17371723
### option: Page.waitForNavigation.waitUntil = %%-navigation-wait-until-%%
17381724

docs/src/api/params.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,25 @@ Options to select. If the `<select>` has the `multiple` attribute, all matching
322322
first option matching one of the passed options is selected. String values are equivalent to `{value:'string'}`. Option
323323
is considered matching if all specified properties match.
324324

325+
## wait-for-navigation-url
326+
- `url` <[string]|[RegExp]|[function]\([URL]\):[boolean]>
327+
328+
A glob pattern, regex pattern or predicate receiving [URL] to match while waiting for the navigation.
329+
330+
## wait-for-event-event
331+
- `event` <[string]>
332+
333+
Event name, same one typically passed into `page.on(event)`.
334+
335+
## wait-for-load-state-state
336+
- `state` <"load"|"domcontentloaded"|"networkidle">
337+
338+
Optional load state to wait for, defaults to `load`. If the state has been already reached while loading current document, the
339+
method resolves immediately. Can be one of:
340+
* `'load'` - wait for the `load` event to be fired.
341+
* `'domcontentloaded'` - wait for the `DOMContentLoaded` event to be fired.
342+
* `'networkidle'` - wait until there are no network connections for at least `500` ms.
343+
325344
## python-select-options-element
326345
* langs: python
327346
- `element` <[ElementHandle]|[Array]<[ElementHandle]>>

0 commit comments

Comments
 (0)