Skip to content

Commit 7c8b46d

Browse files
authored
[js] Close CDP websocket connection on driver.quit (#14501)
1 parent a7a53fb commit 7c8b46d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

‎javascript/node/selenium-webdriver/lib/webdriver.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,14 @@ class WebDriver {
784784
if (this.onQuit_) {
785785
return this.onQuit_.call(void 0)
786786
}
787+
788+
// Close the websocket connection on quit
789+
// If the websocket connection is not closed,
790+
// and we are running CDP sessions against the Selenium Grid,
791+
// the node process never exits since the websocket connection is open until the Grid is shutdown.
792+
if (this._wsConnection !== undefined) {
793+
this._wsConnection.close()
794+
}
787795
})
788796
}
789797

0 commit comments

Comments
 (0)