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

Method quit

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

@override

()

Source from the content-addressed store, hash-verified

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