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

Method get_driver_url

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

Source from the content-addressed store, hash-verified

387 }
388
389 fn get_driver_url(&mut self) -> Result<String, Error> {
390 let major_driver_version = self
391 .get_major_driver_version()
392 .parse::<i32>()
393 .unwrap_or_default();
394
395 if major_driver_version >= MIN_CHROMEDRIVER_VERSION_CFT && self.driver_url.is_none() {
396 // This case happens when driver_version is set (e.g. using CLI flag)
397 self.request_good_driver_version_from_online()?;
398 }
399
400 // As of Chrome 115+, the driver URL is already gathered thanks to the CfT endpoints
401 if self.driver_url.is_some() {
402 return Ok(self.driver_url.as_ref().unwrap().to_string());
403 }
404
405 let driver_version = self.get_driver_version();
406 let os = self.get_os();
407 let arch = self.get_arch();
408 let driver_label = if WINDOWS.is(os) {
409 "win32"
410 } else if MACOS.is(os) {
411 if ARM64.is(arch) {
412 // As of chromedriver 106, the naming convention for macOS ARM64 releases changed. See:
413 // https://groups.google.com/g/chromedriver-users/c/JRuQzH3qr2c
414 if major_driver_version < 106 {
415 "mac64_m1"
416 } else {
417 "mac_arm64"
418 }
419 } else {
420 "mac64"
421 }
422 } else if LINUX.is(os) && ARM64.is(arch) {
423 return Err(anyhow!(
424 "Linux arm64 is not supported yet by Google Chrome. Please try another browser."
425 ));
426 } else {
427 "linux64"
428 };
429 Ok(format!(
430 "{}{}/{}_{}.zip",
431 self.get_driver_mirror_url_or_default(DRIVER_URL),
432 driver_version,
433 self.driver_name,
434 driver_label
435 ))
436 }
437
438 fn get_driver_path_in_cache(&self) -> Result<PathBuf, Error> {
439 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