* Creates a new Firefox session. * * @param {(Options|Capabilities|Object)=} opt_config The * configuration options for this driver, specified as either an * Options or Capabilities, or as a raw hash object. * @param {(http.Executor|remote.DriverService)=} opt_ex
(opt_config, opt_executor)
| 560 | * @return {!Driver} A new driver instance. |
| 561 | */ |
| 562 | static createSession(opt_config, opt_executor) { |
| 563 | let caps = opt_config instanceof Capabilities ? opt_config : new Options(opt_config) |
| 564 | |
| 565 | let firefoxBrowserPath = null |
| 566 | |
| 567 | let executor |
| 568 | let onQuit |
| 569 | |
| 570 | if (opt_executor instanceof http.Executor) { |
| 571 | executor = opt_executor |
| 572 | configureExecutor(executor) |
| 573 | } else if (opt_executor instanceof remote.DriverService) { |
| 574 | if (!opt_executor.getExecutable()) { |
| 575 | const { driverPath, browserPath } = getBinaryPaths(caps) |
| 576 | opt_executor.setExecutable(driverPath) |
| 577 | firefoxBrowserPath = browserPath |
| 578 | } |
| 579 | executor = createExecutor(opt_executor.start()) |
| 580 | onQuit = () => opt_executor.kill() |
| 581 | } else { |
| 582 | let service = new ServiceBuilder().build() |
| 583 | if (!service.getExecutable()) { |
| 584 | const { driverPath, browserPath } = getBinaryPaths(caps) |
| 585 | service.setExecutable(driverPath) |
| 586 | firefoxBrowserPath = browserPath |
| 587 | } |
| 588 | executor = createExecutor(service.start()) |
| 589 | onQuit = () => service.kill() |
| 590 | } |
| 591 | |
| 592 | if (firefoxBrowserPath) { |
| 593 | const vendorOptions = caps.get(FIREFOX_CAPABILITY_KEY) |
| 594 | if (vendorOptions) { |
| 595 | vendorOptions['binary'] = firefoxBrowserPath |
| 596 | caps.set(FIREFOX_CAPABILITY_KEY, vendorOptions) |
| 597 | } else { |
| 598 | caps.set(FIREFOX_CAPABILITY_KEY, { binary: firefoxBrowserPath }) |
| 599 | } |
| 600 | caps.delete(Capability.BROWSER_VERSION) |
| 601 | } |
| 602 | |
| 603 | return /** @type {!Driver} */ (super.createSession(executor, caps, onQuit)) |
| 604 | } |
| 605 | |
| 606 | /** |
| 607 | * This function is a no-op as file detectors are not supported by this |
nothing calls this directly
no test coverage detected