MCPcopy
hub / github.com/MetaMask/metamask-extension / quit

Method quit

test/e2e/webdriver/driver.js:596–620  ·  view source on GitHub ↗

* Quits the browser session, closing all windows and tabs. * * This was previously implemented as just `await this.driver.quit()`, but on Windows, * that was causing Google Chrome for Testing to not close, and sit open indefinitely * taking CPU load. It is also possible that this was cau

()

Source from the content-addressed store, hash-verified

594 * @returns {Promise} promise resolving after quitting
595 */
596 async quit() {
597 if (this.browser === 'chrome') {
598 try {
599 const handles = await this.driver.getAllWindowHandles();
600
601 for (const handle of handles) {
602 await this.driver.switchTo().window(handle);
603 await this.driver.close();
604 }
605 } catch (e) {
606 console.info(
607 'Problem encountered closing Chrome windows/tabs, but continuing anyway',
608 );
609 }
610 }
611
612 try {
613 await this.driver.quit();
614 } catch (error) {
615 console.warn(
616 'Failed to quit driver; continuing under assumption that it was already closed. Error:\n',
617 error,
618 );
619 }
620 }
621
622 /**
623 * Finds an element on the page using the given locator

Callers 2

buildMethod · 0.45
buildMethod · 0.45

Calls 3

getAllWindowHandlesMethod · 0.45
switchToMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected