mirror of
				https://github.com/microsoft/playwright.git
				synced 2025-06-26 21:40:17 +00:00 
			
		
		
		
	docs: add more detail to waitForNavigation API method (#3635)
This commit is contained in:
		
							parent
							
								
									25381cfa43
								
							
						
					
					
						commit
						5f86253ad4
					
				| @ -1935,12 +1935,12 @@ Shortcut for [page.mainFrame().waitForLoadState([options])](#framewaitforloadsta | ||||
| - returns: <[Promise]<[null]|[Response]>> Promise which resolves to the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect. In case of navigation to a different anchor or navigation due to History API usage, the navigation will resolve with `null`. | ||||
| 
 | ||||
| This resolves when the page navigates to a new URL or reloads. It is useful for when you run code | ||||
| which will indirectly cause the page to navigate. Consider this example: | ||||
| which will indirectly cause the page to navigate. e.g. The click target has an `onclick` handler that triggers navigation from a `setTimeout`. Consider this example: | ||||
| 
 | ||||
| ```js | ||||
| const [response] = await Promise.all([ | ||||
|   page.waitForNavigation(), // The promise resolves after navigation has finished | ||||
|   page.click('a.my-link'), // Clicking the link will indirectly cause a navigation | ||||
|   page.click('a.delayed-navigation'), // Clicking the link will indirectly cause a navigation | ||||
| ]); | ||||
| ``` | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Blake Williams
						Blake Williams