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

Method close

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

* Close ws connection. * @returns {Promise }

()

Source from the content-addressed store, hash-verified

488 * @returns {Promise<unknown>}
489 */
490 close() {
491 this._failPending(new Error('BiDi connection closed before response was received'))
492
493 const closeWebSocket = (callback) => {
494 // don't close if it's already closed
495 if (this._ws.readyState === 3) {
496 callback()
497 } else {
498 // don't notify on user-initiated shutdown ('disconnect' event)
499 this._ws.removeAllListeners('close')
500 this._ws.once('close', () => {
501 this._ws.removeAllListeners()
502 callback()
503 })
504 this._ws.close()
505 }
506 }
507 return new Promise((fulfill, _) => {
508 closeWebSocket(fulfill)
509 })
510 }
511}
512
513/**

Callers

nothing calls this directly

Calls 1

_failPendingMethod · 0.95

Tested by

no test coverage detected