Skip to content

Commit a37a727

Browse files
committed
[js] Close BiDi websocket connection
1 parent 375e841 commit a37a727

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,10 @@ class WebDriver {
792792
if (this._wsConnection !== undefined) {
793793
this._wsConnection.close()
794794
}
795+
796+
if (this._bidi !== undefined) {
797+
this._bidi.close()
798+
}
795799
})
796800
}
797801

@@ -1288,9 +1292,12 @@ class WebDriver {
12881292
* @returns {BIDI}
12891293
*/
12901294
async getBidi() {
1291-
const caps = await this.getCapabilities()
1295+
if (this._bidi === undefined) {
1296+
const caps = await this.getCapabilities()
12921297
let WebSocketUrl = caps['map_'].get('webSocketUrl')
1293-
return new BIDI(WebSocketUrl.replace('localhost', '127.0.0.1'))
1298+
this._bidi = new BIDI(WebSocketUrl.replace('localhost', '127.0.0.1'))
1299+
}
1300+
return this._bidi;
12941301
}
12951302

12961303
/**

0 commit comments

Comments
 (0)