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

Function gridArgs

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

* Gives the Grid node a slot for only the browser under test, so it doesn't run Selenium Manager * for every browser at startup. A Bazel-provided driver and browser are pinned in that slot; on * CI, Selenium Manager would find no installed browser. * @param {!Array } browserNames the brows

(browserNames)

Source from the content-addressed store, hash-verified

657 * @return {!Array<string>} empty to keep driver detection.
658 */
659function gridArgs(browserNames) {
660 // The command line merges repeated --driver-configuration flags into one, so only a single
661 // browser can have a slot; with several, detection must stay on to give each one a slot.
662 if (browserNames.length !== 1 || !(browserNames[0] in GRID_BROWSERS)) {
663 return []
664 }
665 const [browserName] = browserNames
666 const [driverVar, browserVar, vendorKey] = GRID_BROWSERS[browserName]
667 const slot = [`display-name=${browserName}`, 'max-sessions=1']
668 const stereotype = { browserName }
669 if (process.env[driverVar] && process.env[browserVar]) {
670 slot.push(`webdriver-executable=${locate(process.env[driverVar])}`)
671 stereotype[vendorKey] = { binary: locate(process.env[browserVar]) }
672 }
673 return ['--detect-drivers', 'false', '--driver-configuration', ...slot, `stereotype=${JSON.stringify(stereotype)}`]
674}
675
676function locate(fileLike) {
677 if (fs.existsSync(fileLike)) {

Callers 1

suiteFunction · 0.85

Calls 2

locateFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected