Pin the driver and browser in a driver-configuration so the Grid node skips Selenium Manager. Returns an empty list when nothing is pinned, keeping the default Selenium Manager behavior.
(config)
| 223 | |
| 224 | |
| 225 | def _pinned_grid_args(config): |
| 226 | """Pin the driver and browser in a driver-configuration so the Grid node skips Selenium Manager. |
| 227 | |
| 228 | Returns an empty list when nothing is pinned, keeping the default Selenium Manager behavior. |
| 229 | """ |
| 230 | drivers_opt = config.option.drivers or [] |
| 231 | driver = next((d for d in drivers_opt if d.lower() in _GRID_VENDOR_OPTIONS), None) |
| 232 | executable = config.option.executable # --driver-binary |
| 233 | binary = config.option.binary # --browser-binary |
| 234 | if not (driver and executable and binary): |
| 235 | return [] |
| 236 | |
| 237 | driver_path = _resolve_bazel_path(executable).strip("'") |
| 238 | browser_path = _resolve_bazel_path(binary).strip("'") |
| 239 | browser_name, vendor_key = _GRID_VENDOR_OPTIONS[driver.lower()] |
| 240 | stereotype = json.dumps({"browserName": browser_name, vendor_key: {"binary": browser_path}}) |
| 241 | return [ |
| 242 | "--enable-managed-downloads", |
| 243 | "true", |
| 244 | "--detect-drivers", |
| 245 | "false", |
| 246 | "--driver-configuration", |
| 247 | f"display-name={driver}", |
| 248 | "max-sessions=1", |
| 249 | f"webdriver-executable={driver_path}", |
| 250 | f"stereotype={stereotype}", |
| 251 | ] |
| 252 | |
| 253 | |
| 254 | def get_extensions_location(): |
no test coverage detected