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

Method get_driver_url

rust/src/chrome.rs:437–487  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

435 }
436
437 fn get_driver_url(&mut self) -> Result<String, Error> {
438 let major_driver_version = self
439 .get_major_driver_version()
440 .parse::<i32>()
441 .unwrap_or_default();
442
443 if major_driver_version >= MIN_CHROMEDRIVER_VERSION_CFT && self.driver_url.is_none() {
444 // This case happens when driver_version is set (e.g. using CLI flag)
445 self.request_good_driver_version_from_online()?;
446 }
447
448 // As of Chrome 115+, the driver URL is already gathered thanks to the CfT endpoints
449 if self.driver_url.is_some() {
450 return Ok(self.driver_url.as_ref().unwrap().to_string());
451 }
452
453 let driver_version = self.get_driver_version();
454 let os = self.get_os();
455 let arch = self.get_arch();
456 let driver_label = if WINDOWS.is(os) {
457 "win32"
458 } else if MACOS.is(os) {
459 if ARM64.is(arch) {
460 // As of chromedriver 106, the naming convention for macOS ARM64 releases changed. See:
461 // https://groups.google.com/g/chromedriver-users/c/JRuQzH3qr2c
462 if major_driver_version < 106 {
463 "mac64_m1"
464 } else {
465 "mac_arm64"
466 }
467 } else {
468 "mac64"
469 }
470 } else if LINUX.is(os) && ARM64.is(arch) {
471 // This URL scheme only serves chromedriver 114-, which was never published for Linux
472 // arm64. Newer versions are served by the CfT endpoints and never reach this point.
473 return Err(anyhow!(format!(
474 "Linux arm64 requires {} {} or above",
475 self.driver_name, MIN_CHROME_VERSION_LINUX_ARM64
476 )));
477 } else {
478 "linux64"
479 };
480 Ok(format!(
481 "{}{}/{}_{}.zip",
482 self.get_driver_mirror_url_or_default(DRIVER_URL),
483 driver_version,
484 self.driver_name,
485 driver_label
486 ))
487 }
488
489 fn get_driver_path_in_cache(&self) -> Result<PathBuf, Error> {
490 Ok(compose_driver_path_in_cache(

Callers

nothing calls this directly

Calls 6

get_driver_versionMethod · 0.80
get_osMethod · 0.80
get_archMethod · 0.80
isMethod · 0.65

Tested by

no test coverage detected