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

Method find_best_driver_from_cache

rust/src/lib.rs:1101–1120  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

1099 }
1100
1101 fn find_best_driver_from_cache(&self) -> Result<Option<PathBuf>, Error> {
1102 let cache_path = self.get_cache_path()?.unwrap_or_default();
1103 let drivers_in_cache_matching_version = collect_files_from_cache(&cache_path, |entry| {
1104 self.is_driver_and_matches_browser_version(entry)
1105 });
1106
1107 // First we look for drivers in cache that matches browser version (should work for Chrome and Edge)
1108 if !drivers_in_cache_matching_version.is_empty() {
1109 Ok(Some(
1110 drivers_in_cache_matching_version
1111 .iter()
1112 .last()
1113 .unwrap()
1114 .to_owned(),
1115 ))
1116 } else {
1117 // If not available, we look for the latest available driver in the cache
1118 find_latest_from_cache(&cache_path, |entry| self.is_driver(entry))
1119 }
1120 }
1121
1122 fn get_major_version(&self, full_version: &str) -> Result<String, Error> {
1123 get_index_version(full_version, 0)

Callers 1

mainFunction · 0.80

Implementers 8

edge.rsrust/src/edge.rs
iexplorer.rsrust/src/iexplorer.rs
safaritp.rsrust/src/safaritp.rs
electron.rsrust/src/electron.rs
chrome.rsrust/src/chrome.rs
firefox.rsrust/src/firefox.rs
grid.rsrust/src/grid.rs
safari.rsrust/src/safari.rs

Calls 6

collect_files_from_cacheFunction · 0.85
find_latest_from_cacheFunction · 0.85
get_cache_pathMethod · 0.80
is_emptyMethod · 0.80
is_driverMethod · 0.80

Tested by

no test coverage detected