docs: improve note on `browser.close()` behavior (#34039)

This commit is contained in:
Yury Semikhatsky 2024-12-16 13:52:17 -08:00 committed by GitHub
parent 76bb01d77c
commit b58a4762f4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View File

@ -96,7 +96,7 @@ In case this browser is connected to, clears all created contexts belonging to t
browser server.
:::note
This is similar to force quitting the browser. Therefore, you should call [`method: BrowserContext.close`] on any [BrowserContext]'s you explicitly created earlier with [`method: Browser.newContext`] **before** calling [`method: Browser.close`].
This is similar to force-quitting the browser. To close pages gracefully and ensure you receive page close events, call [`method: BrowserContext.close`] on any [BrowserContext] instances you explicitly created earlier using [`method: Browser.newContext`] **before** calling [`method: Browser.close`].
:::
The [Browser] object itself is considered to be disposed and cannot be used anymore.

View File

@ -9589,10 +9589,11 @@ export interface Browser {
* In case this browser is connected to, clears all created contexts belonging to this browser and disconnects from
* the browser server.
*
* **NOTE** This is similar to force quitting the browser. Therefore, you should call
* **NOTE** This is similar to force-quitting the browser. To close pages gracefully and ensure you receive page close
* events, call
* [browserContext.close([options])](https://playwright.dev/docs/api/class-browsercontext#browser-context-close) on
* any [BrowserContext](https://playwright.dev/docs/api/class-browsercontext)'s you explicitly created earlier with
* [browser.newContext([options])](https://playwright.dev/docs/api/class-browser#browser-new-context) **before**
* any [BrowserContext](https://playwright.dev/docs/api/class-browsercontext) instances you explicitly created earlier
* using [browser.newContext([options])](https://playwright.dev/docs/api/class-browser#browser-new-context) **before**
* calling [browser.close([options])](https://playwright.dev/docs/api/class-browser#browser-close).
*
* The [Browser](https://playwright.dev/docs/api/class-browser) object itself is considered to be disposed and cannot