Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
docs: improve note on `browser.close()` behavior (#34039)
Yury Semikhatskyb58a4762f46a
diff --git a/docs/src/api/class-browser.md b/docs/src/api/class-browser.mdindex 4dabfc52e4..7867ce5c8b 100644--- a/docs/src/api/class-browser.md+++ b/docs/src/api/class-browser.md@@ -96,7 +96,7 @@ In case this browser is connected to, clears all created contexts belonging to tbrowser 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.diff --git a/packages/playwright-core/types/types.d.ts b/packages/playwright-core/types/types.d.tsindex cb83bb4ccd..ba83204e7e 100644--- a/packages/playwright-core/types/types.d.ts+++ b/packages/playwright-core/types/types.d.ts@@ -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