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

Method general_discover_browser_version

rust/src/lib.rs:1252–1297  ·  view source on GitHub ↗
(
        &mut self,
        reg_key: &'static str,
        reg_version_arg: &'static str,
        cmd_version_arg: &str,
    )

Source from the content-addressed store, hash-verified

1250 }
1251
1252 fn general_discover_browser_version(
1253 &mut self,
1254 reg_key: &'static str,
1255 reg_version_arg: &'static str,
1256 cmd_version_arg: &str,
1257 ) -> Result<Option<String>, Error> {
1258 let mut browser_path = self.get_browser_path().to_string();
1259 if browser_path.is_empty() {
1260 if let Some(path) = self.detect_browser_path() {
1261 browser_path = path_to_string(&path);
1262 }
1263 } else if !Path::new(&browser_path).exists() {
1264 self.set_fallback_driver_from_cache(false);
1265 return Err(anyhow!(format_one_arg(
1266 "Browser path does not exist: {}",
1267 &browser_path,
1268 )));
1269 }
1270 let escaped_browser_path = self.get_escaped_path(browser_path.to_string());
1271
1272 let mut commands = Vec::new();
1273 if WINDOWS.is(self.get_os()) {
1274 if !escaped_browser_path.is_empty() && !self.is_webview2() {
1275 return Ok(get_win_file_version(&escaped_browser_path));
1276 }
1277 if !self.is_browser_version_unstable() {
1278 let reg_command = Command::new(
1279 "REG",
1280 vec![
1281 String::from("QUERY"),
1282 reg_key.to_string(),
1283 String::from("/v"),
1284 reg_version_arg.to_string(),
1285 ],
1286 );
1287 commands.push(reg_command);
1288 }
1289 } else if !escaped_browser_path.is_empty() {
1290 commands.push(Command::new(
1291 escaped_browser_path,
1292 vec![cmd_version_arg.to_string()],
1293 ));
1294 }
1295
1296 Ok(self.detect_browser_version(commands))
1297 }
1298
1299 fn discover_safari_version(&mut self, safari_path: String) -> Result<Option<String>, Error> {
1300 let mut browser_path = self.get_browser_path().to_string();

Callers 4

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 13

path_to_stringFunction · 0.85
get_win_file_versionFunction · 0.85
is_emptyMethod · 0.80
detect_browser_pathMethod · 0.80
existsMethod · 0.80
get_escaped_pathMethod · 0.80
get_osMethod · 0.80
is_webview2Method · 0.80
isMethod · 0.65

Tested by

no test coverage detected