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

Method build

javascript/selenium-webdriver/firefox.js:422–438  ·  view source on GitHub ↗

* Overrides the parent build() method to let Firefox pick the websocket port * when not connecting to an existing instance and no port was supplied. * * @return {!DriverService} A new driver service instance.

()

Source from the content-addressed store, hash-verified

420 * @return {!DriverService} A new driver service instance.
421 */
422 build() {
423 let port = this.options_.port || findFreePort()
424 let argsPromise = Promise.all([port, Promise.all(this.options_.args)]).then(([port, userArgs]) => {
425 // Start with the default --port argument.
426 let args = userArgs.concat(`--port=${port}`)
427 const skipWebSocketPort = userArgs.some(
428 (arg) => arg === '--connect-existing' || (typeof arg === 'string' && arg.startsWith('--websocket-port')),
429 )
430 if (!skipWebSocketPort) {
431 args.push('--websocket-port=0')
432 }
433 return args
434 })
435
436 let options = Object.assign({}, this.options_, { args: argsPromise, port })
437 return new remote.DriverService(this.exe_, options)
438 }
439}
440
441/**

Callers

nothing calls this directly

Calls 2

findFreePortFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected