Skip to content

Commit

Permalink
[js] Close BiDi websocket connection
Browse files Browse the repository at this point in the history
  • Loading branch information
pujagani committed Sep 17, 2024
1 parent 375e841 commit a37a727
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions javascript/node/selenium-webdriver/lib/webdriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,10 @@ class WebDriver {
if (this._wsConnection !== undefined) {
this._wsConnection.close()
}

if (this._bidi !== undefined) {
this._bidi.close()
}
})
}

Expand Down Expand Up @@ -1288,9 +1292,12 @@ class WebDriver {
* @returns {BIDI}
*/
async getBidi() {
const caps = await this.getCapabilities()
if (this._bidi === undefined) {
const caps = await this.getCapabilities()
let WebSocketUrl = caps['map_'].get('webSocketUrl')
return new BIDI(WebSocketUrl.replace('localhost', '127.0.0.1'))
this._bidi = new BIDI(WebSocketUrl.replace('localhost', '127.0.0.1'))
}
return this._bidi;
}

/**
Expand Down

0 comments on commit a37a727

Please sign in to comment.