@override
()
| 768 | |
| 769 | /** @override */ |
| 770 | quit() { |
| 771 | let result = this.execute(new command.Command(command.Name.QUIT)) |
| 772 | // Delete our session ID when the quit command finishes; this will allow us |
| 773 | // to throw an error when attempting to use a driver post-quit. |
| 774 | return promise.finally(result, () => { |
| 775 | this.session_ = Promise.reject( |
| 776 | new error.NoSuchSessionError( |
| 777 | 'This driver instance does not have a valid session ID ' + |
| 778 | '(did you call WebDriver.quit()?) and may no longer be used.', |
| 779 | ), |
| 780 | ) |
| 781 | |
| 782 | // Only want the session rejection to bubble if accessed. |
| 783 | this.session_.catch(function () {}) |
| 784 | |
| 785 | if (this.onQuit_) { |
| 786 | return this.onQuit_.call(void 0) |
| 787 | } |
| 788 | |
| 789 | // Close the websocket connection on quit |
| 790 | // If the websocket connection is not closed, |
| 791 | // and we are running CDP sessions against the Selenium Grid, |
| 792 | // the node process never exits since the websocket connection is open until the Grid is shutdown. |
| 793 | if (this._cdpWsConnection !== undefined) { |
| 794 | this._cdpWsConnection.close() |
| 795 | } |
| 796 | |
| 797 | // Close the BiDi websocket connection |
| 798 | if (this._bidiConnection !== undefined) { |
| 799 | this._bidiConnection.close() |
| 800 | } |
| 801 | }) |
| 802 | } |
| 803 | |
| 804 | /** @override */ |
| 805 | actions(options) { |