MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / quit

Method quit

javascript/selenium-webdriver/lib/webdriver.js:780–811  ·  view source on GitHub ↗

@override

()

Source from the content-addressed store, hash-verified

778
779 /** @override */
780 quit() {
781 let result = this.execute(new command.Command(command.Name.QUIT))
782 // Delete our session ID when the quit command finishes; this will allow us
783 // to throw an error when attempting to use a driver post-quit.
784 return promise.finally(result, () => {
785 this.session_ = Promise.reject(
786 new error.NoSuchSessionError(
787 'This driver instance does not have a valid session ID ' +
788 '(did you call WebDriver.quit()?) and may no longer be used.',
789 ),
790 )
791
792 // Only want the session rejection to bubble if accessed.
793 this.session_.catch(function () {})
794
795 if (this.onQuit_) {
796 return this.onQuit_.call(void 0)
797 }
798
799 // Close the websocket connection on quit
800 // If the websocket connection is not closed,
801 // and we are running CDP sessions against the Selenium Grid,
802 // the node process never exits since the websocket connection is open until the Grid is shutdown.
803 if (this._cdpWsConnection !== undefined) {
804 this._cdpWsConnection.close()
805 }
806
807 // Not awaited: the session is already torn down by this point, so
808 // closing our end of the socket doesn't need to gate quit() completing.
809 closeBidiConnection(this)
810 })
811 }
812
813 /** @override */
814 actions(options) {

Callers

nothing calls this directly

Calls 4

executeMethod · 0.95
closeBidiConnectionFunction · 0.85
callMethod · 0.65
closeMethod · 0.65

Tested by

no test coverage detected