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