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

Function _grid_args

py/conftest.py:224–252  ·  view source on GitHub ↗

Register only the browser under test, so Grid does not run Selenium Manager for every browser at startup. Several drivers keep detection, because the server command line accepts only one driver-configuration.

(config)

Source from the content-addressed store, hash-verified

222
223
224def _grid_args(config):
225 """Register only the browser under test, so Grid does not run Selenium Manager for every browser at startup.
226
227 Several drivers keep detection, because the server command line accepts only one driver-configuration.
228 """
229 drivers = config.option.drivers or []
230 driver = drivers[0] if len(drivers) == 1 else None
231 if driver not in _GRID_VENDOR_OPTIONS:
232 return []
233
234 browser_name, vendor_key = _GRID_VENDOR_OPTIONS[driver]
235 stereotype = {"browserName": browser_name}
236 driver_configuration = [f"display-name={driver}", "max-sessions=1"]
237 executable = config.option.executable # --driver-binary
238 binary = config.option.binary # --browser-binary
239 if executable and binary:
240 driver_path = _resolve_bazel_path(executable).strip("'")
241 browser_path = _resolve_bazel_path(binary).strip("'")
242 driver_configuration.append(f"webdriver-executable={driver_path}")
243 stereotype[vendor_key] = {"binary": browser_path}
244 return [
245 "--enable-managed-downloads",
246 "true",
247 "--detect-drivers",
248 "false",
249 "--driver-configuration",
250 *driver_configuration,
251 f"stereotype={json.dumps(stereotype)}",
252 ]
253
254
255# Maps the test driver name to the env var its Service consults before invoking Selenium Manager.

Callers 1

serverFunction · 0.85

Calls 2

_resolve_bazel_pathFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected