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

Method find_best_driver_from_cache

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

Source from the content-addressed store, hash-verified

1121 }
1122
1123 fn find_best_driver_from_cache(&self) -> Result<Option<PathBuf>, Error> {
1124 let cache_path = self.get_cache_path()?.unwrap_or_default();
1125 let drivers_in_cache_matching_version = collect_files_from_cache(&cache_path, |entry| {
1126 self.is_driver_and_matches_browser_version(entry)
1127 });
1128
1129 // First we look for drivers in cache that matches browser version (should work for Chrome and Edge)
1130 if !drivers_in_cache_matching_version.is_empty() {
1131 Ok(Some(
1132 drivers_in_cache_matching_version
1133 .iter()
1134 .last()
1135 .unwrap()
1136 .to_owned(),
1137 ))
1138 } else {
1139 // If not available, we look for the latest available driver in the cache
1140 find_latest_from_cache(&cache_path, |entry| self.is_driver(entry))
1141 }
1142 }
1143
1144 fn get_major_version(&self, full_version: &str) -> Result<String, Error> {
1145 get_index_version(full_version, 0)

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