docs: remove toc and api reference (#17098)
This commit is contained in:
parent
d7e45c44de
commit
ca753e1884
|
|
@ -7,7 +7,7 @@ Playwright can interact with the web page dialogs such as [`alert`](https://deve
|
|||
|
||||
## alert(), confirm(), prompt() dialogs
|
||||
|
||||
By default, dialogs are auto-dismissed by Playwright, so you don't have to handle them. However, you can register a dialog handler before the action that triggers the dialog to accept or decline it.
|
||||
By default, dialogs are auto-dismissed by Playwright, so you don't have to handle them. However, you can register a dialog handler before the action that triggers the dialog to either [`method: Dialog.accept`] or [`method: Dialog.dismiss`] it.
|
||||
|
||||
```js
|
||||
page.on('dialog', dialog => dialog.accept());
|
||||
|
|
@ -35,7 +35,7 @@ await page.Locator("button").ClickAsync();
|
|||
```
|
||||
|
||||
:::note
|
||||
[`event: Page.dialog`] listener **must handle** the dialog. Otherwise your action will stall, be it [`method: Page.click`], [`method: Page.evaluate`] or any other. That's because dialogs in Web are modals and therefore block further page execution until they are handled.
|
||||
[`event: Page.dialog`] listener **must handle** the dialog. Otherwise your action will stall, be it [`method: Locator.click`] or something else. That's because dialogs in Web are modals and therefore block further page execution until they are handled.
|
||||
:::
|
||||
|
||||
As a result, the following snippet will never resolve:
|
||||
|
|
@ -73,12 +73,6 @@ await page.Locator("button").ClickAsync(); // Will hang here
|
|||
If there is no listener for [`event: Page.dialog`], all dialogs are automatically dismissed.
|
||||
:::
|
||||
|
||||
### API reference
|
||||
|
||||
- [Dialog]
|
||||
- [`method: Dialog.accept`]
|
||||
- [`method: Dialog.dismiss`]
|
||||
|
||||
## beforeunload dialog
|
||||
|
||||
When [`method: Page.close`] is invoked with the truthy [`option: runBeforeUnload`] value, the page runs its unload handlers. This is the only case when [`method: Page.close`] does not wait for the page to actually close, because it might be that the page stays open in the end of the operation.
|
||||
|
|
|
|||
Loading…
Reference in a new issue