MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / _stopBrowser

Method _stopBrowser

lib/helper/Playwright.js:1228–1268  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1226 }
1227
1228 async _stopBrowser() {
1229 this.withinLocator = null
1230 await this._setPage(null)
1231 this.context = null
1232 this.frame = null
1233 popupStore.clear()
1234
1235 // Remove all event listeners to prevent hanging
1236 if (this.browser) {
1237 try {
1238 this.browser.removeAllListeners()
1239 } catch (e) {
1240 // Ignore errors if browser is already closed
1241 }
1242 }
1243
1244 // Close browserContext if recordHar is enabled
1245 if (this.options.recordHar && this.browserContext) {
1246 try {
1247 await this.browserContext.close()
1248 } catch (e) {
1249 // Ignore errors if context is already closed
1250 }
1251 }
1252 this.browserContext = null
1253
1254 // Initiate browser close without waiting for it to complete
1255 // The browser process will be cleaned up when the Node process exits
1256 if (this.browser) {
1257 try {
1258 // Fire and forget - don't wait for close to complete
1259 this.browser.close().catch(() => {
1260 // Silently ignore any errors during async close
1261 })
1262 } catch (e) {
1263 // Ignore any synchronous errors
1264 }
1265 }
1266 this.browser = null
1267 this.isRunning = false
1268 }
1269
1270 async _evaluateHandeInContext(...args) {
1271 const context = await this._getContext()

Callers 4

_afterMethod · 0.95
_afterSuiteMethod · 0.95
_finishTestMethod · 0.95
_cleanupMethod · 0.95

Calls 2

_setPageMethod · 0.95
clearMethod · 0.45

Tested by

no test coverage detected