docs: remove toc and api ref from navigations doc (#17627)

This commit is contained in:
Debbie O'Brien 2022-09-27 17:45:12 +02:00 committed by GitHub
parent 1e286ffdc7
commit cfcf1dfb4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,10 +3,7 @@ id: navigations
title: "Navigations" title: "Navigations"
--- ---
Playwright can navigate to URLs and handle navigations caused by page interactions. This guide covers common scenarios Playwright can navigate to URLs and handle navigations caused by page interactions. This guide covers common scenarios to wait for page navigations and loading to complete.
to wait for page navigations and loading to complete.
<!-- TOC -->
## Navigation lifecycle ## Navigation lifecycle
@ -62,7 +59,6 @@ page.goto("https://example.com")
await page.GotoAsync("https://example.com"); await page.GotoAsync("https://example.com");
``` ```
### Custom wait ### Custom wait
Override the default behavior to wait until a specific event, like `networkidle`. Override the default behavior to wait until a specific event, like `networkidle`.
@ -153,20 +149,13 @@ await page.GotoAsync("https://example.com");
await page.Locator("text=Example Domain").ClickAsync(); await page.Locator("text=Example Domain").ClickAsync();
``` ```
### API reference
- [`method: Page.goto`]
- [`method: Page.reload`]
- [`method: Page.goBack`]
- [`method: Page.goForward`]
## Scenarios initiated by page interaction ## Scenarios initiated by page interaction
In the scenarios below, [`method: Locator.click`] initiates a navigation and then waits for the navigation to complete. In the scenarios below, [`method: Locator.click`] initiates a navigation and then waits for the navigation to complete.
### Auto-wait ### Auto-wait
By default, [`method: Locator.click`] will wait for the navigation step to complete. This can be combined with a page interaction on By default, [`method: Locator.click`] will wait for the navigation step to complete. This can be combined with a page interaction on the navigated page which would auto-wait for an element.
the navigated page which would auto-wait for an element.
```js ```js
// Click will auto-wait for navigation to complete // Click will auto-wait for navigation to complete
@ -412,8 +401,7 @@ await page.RunAndWaitForNavigationAsync(async () =>
### Loading a popup ### Loading a popup
When popup is opened, explicitly calling [`method: Page.waitForLoadState`] ensures that popup is loaded to the desired When popup is opened, explicitly calling [`method: Page.waitForLoadState`] ensures that popup is loaded to the desired state.
state.
```js ```js
// Note that Promise.all prevents a race condition // Note that Promise.all prevents a race condition
@ -456,16 +444,9 @@ var popup = await page.RunAndWaitForPopupAsync(async () =>
popup.WaitForLoadStateAsync(LoadState.Load); popup.WaitForLoadStateAsync(LoadState.Load);
``` ```
### API reference
- [`method: Locator.click`]
- [`method: Page.waitForLoadState`]
- [`method: Page.waitForNavigation`]
- [`method: Page.waitForFunction`]
## Advanced patterns ## Advanced patterns
For pages that have complicated loading patterns, [`method: Page.waitForFunction`] is a powerful and extensible approach For pages that have complicated loading patterns, [`method: Page.waitForFunction`] is a powerful and extensible approach to define a custom wait criteria.
to define a custom wait criteria.
```js ```js
await page.goto('http://example.com'); await page.goto('http://example.com');
@ -501,6 +482,3 @@ await page.WaitForFunctionAsync("() => window.amILoadedYet()");
// Ready to take a screenshot, according to the page itself. // Ready to take a screenshot, according to the page itself.
await page.ScreenshotAsync(); await page.ScreenshotAsync();
``` ```
### API reference
- [`method: Page.waitForFunction`]