MCPcopy
hub / github.com/codeceptjs/CodeceptJS / closeOtherTabs

Method closeOtherTabs

lib/helper/WebDriver.js:2435–2445  ·  view source on GitHub ↗

* {{> closeOtherTabs }}

()

Source from the content-addressed store, hash-verified

2433 * {{> closeOtherTabs }}
2434 */
2435 async closeOtherTabs() {
2436 const handles = await this.browser.getWindowHandles()
2437 const currentHandle = await this.browser.getWindowHandle()
2438 const otherHandles = handles.filter(handle => handle !== currentHandle)
2439
2440 await forEachAsync(otherHandles, async handle => {
2441 await this.browser.switchToWindow(handle)
2442 await this.browser.closeWindow()
2443 })
2444 await this.browser.switchToWindow(currentHandle)
2445 }
2446
2447 /**
2448 * {{> wait }}

Callers 1

_afterMethod · 0.95

Calls 3

forEachAsyncFunction · 0.85
filterMethod · 0.80
switchToWindowMethod · 0.80

Tested by

no test coverage detected