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

Method createSession

javascript/selenium-webdriver/chromium.js:619–656  ·  view source on GitHub ↗

* Creates a new session with the WebDriver server. * * @param {(Capabilities|Options)=} caps The configuration options. * @param {(remote.DriverService|http.Executor)=} opt_serviceExecutor Either * a DriverService to use for the remote end, or a preconfigured executor * for a

(caps, opt_serviceExecutor, vendorPrefix = '', vendorCapabilityKey = '')

Source from the content-addressed store, hash-verified

617 * @return {!Driver} A new driver instance.
618 */
619 static createSession(caps, opt_serviceExecutor, vendorPrefix = '', vendorCapabilityKey = '') {
620 let executor
621 let onQuit
622 if (opt_serviceExecutor instanceof http.Executor) {
623 executor = opt_serviceExecutor
624 configureExecutor(executor, vendorPrefix)
625 } else {
626 let service = opt_serviceExecutor || this.getDefaultService()
627 if (!service.getExecutable()) {
628 const { driverPath, browserPath } = getBinaryPaths(caps)
629 service.setExecutable(driverPath)
630 if (browserPath) {
631 const vendorOptions = caps.get(vendorCapabilityKey)
632 if (vendorOptions) {
633 vendorOptions['binary'] = browserPath
634 caps.set(vendorCapabilityKey, vendorOptions)
635 } else {
636 caps.set(vendorCapabilityKey, { binary: browserPath })
637 }
638 caps.delete(Capability.BROWSER_VERSION)
639 }
640 }
641 onQuit = () => service.kill()
642 executor = createExecutor(service.start(), vendorPrefix)
643 }
644
645 // W3C spec requires noProxy value to be an array of strings, but Chromium
646 // expects a single host as a string.
647 let proxy = caps.get(Capability.PROXY)
648 if (proxy && Array.isArray(proxy.noProxy)) {
649 proxy.noProxy = proxy.noProxy[0]
650 if (!proxy.noProxy) {
651 proxy.noProxy = undefined
652 }
653 }
654
655 return /** @type {!Driver} */ (super.createSession(executor, caps, onQuit))
656 }
657
658 /**
659 * This function is a no-op as file detectors are not supported by this

Callers

nothing calls this directly

Calls 11

getDefaultServiceMethod · 0.95
getBinaryPathsFunction · 0.85
configureExecutorFunction · 0.70
createExecutorFunction · 0.70
getMethod · 0.65
setMethod · 0.65
startMethod · 0.65
getExecutableMethod · 0.45
setExecutableMethod · 0.45
deleteMethod · 0.45
killMethod · 0.45

Tested by

no test coverage detected