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

Method close

javascript/selenium-webdriver/bidi/index.js:318–338  ·  view source on GitHub ↗

* Close ws connection. * @returns {Promise }

()

Source from the content-addressed store, hash-verified

316 * @returns {Promise<unknown>}
317 */
318 close() {
319 this._failPending(new Error('BiDi connection closed before response was received'))
320
321 const closeWebSocket = (callback) => {
322 // don't close if it's already closed
323 if (this._ws.readyState === 3) {
324 callback()
325 } else {
326 // don't notify on user-initiated shutdown ('disconnect' event)
327 this._ws.removeAllListeners('close')
328 this._ws.once('close', () => {
329 this._ws.removeAllListeners()
330 callback()
331 })
332 this._ws.close()
333 }
334 }
335 return new Promise((fulfill, _) => {
336 closeWebSocket(fulfill)
337 })
338 }
339}
340
341/**

Callers

nothing calls this directly

Calls 1

_failPendingMethod · 0.95

Tested by

no test coverage detected