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

Function pinnedGridArgs

javascript/selenium-webdriver/testing/index.js:632–653  ·  view source on GitHub ↗

* Pins the Grid node to the Bazel-provided driver and browser; on CI, Selenium Manager would find * no installed browser. * @param {!Array } browserNames the browsers sharing the server. * @return {!Array } empty to keep driver detection.

(browserNames)

Source from the content-addressed store, hash-verified

630 * @return {!Array<string>} empty to keep driver detection.
631 */
632function pinnedGridArgs(browserNames) {
633 // The command line merges repeated --driver-configuration flags into one, so only a single
634 // browser can be pinned; with several, detection must stay on to give each one a slot.
635 if (browserNames.length !== 1) {
636 return []
637 }
638 const [browserName] = browserNames
639 const [driverVar, browserVar, vendorKey] = PINNED_BROWSERS[browserName] ?? []
640 if (!process.env[driverVar] || !process.env[browserVar]) {
641 return []
642 }
643 const stereotype = JSON.stringify({ browserName, [vendorKey]: { binary: locate(process.env[browserVar]) } })
644 return [
645 '--detect-drivers',
646 'false',
647 '--driver-configuration',
648 `display-name=${browserName}`,
649 'max-sessions=1',
650 `webdriver-executable=${locate(process.env[driverVar])}`,
651 `stereotype=${stereotype}`,
652 ]
653}
654
655function locate(fileLike) {
656 if (fs.existsSync(fileLike)) {

Callers 1

suiteFunction · 0.85

Calls 1

locateFunction · 0.85

Tested by

no test coverage detected