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

Method default

rust/src/config.rs:73–129  ·  view source on GitHub ↗
(browser_name: &str, driver_name: &str)

Source from the content-addressed store, hash-verified

71
72impl ManagerConfig {
73 pub fn default(browser_name: &str, driver_name: &str) -> ManagerConfig {
74 let cache_path = StringKey(vec![CACHE_PATH_KEY], &read_cache_path()).get_value();
75
76 let self_os = OS;
77 let self_arch = if WINDOWS.is(self_os) {
78 get_win_os_architecture()
79 } else {
80 let uname_a_command = Command::new(UNAME_COMMAND, vec![String::from("-a")]);
81 if run_shell_command(uname_a_command)
82 .unwrap_or_default()
83 .to_ascii_lowercase()
84 .contains(ARCH_ARM64)
85 {
86 ARCH_ARM64.to_string()
87 } else {
88 let uname_m_command = Command::new(UNAME_COMMAND, vec![String::from("-m")]);
89 run_shell_command(uname_m_command).unwrap_or_default()
90 }
91 };
92
93 let browser_version_label = concat(browser_name, VERSION_PREFIX);
94 let driver_version_label = concat(driver_name, VERSION_PREFIX);
95 let browser_path_label = concat(browser_name, PATH_PREFIX);
96 let driver_mirror_label = concat(driver_name, MIRROR_PREFIX);
97 let browser_mirror_label = concat(browser_name, MIRROR_PREFIX);
98
99 ManagerConfig {
100 cache_path,
101 fallback_driver_from_cache: true,
102 browser_version: StringKey(vec!["browser-version", &browser_version_label], "")
103 .get_value(),
104 driver_version: StringKey(vec!["driver-version", &driver_version_label], "")
105 .get_value(),
106 browser_path: StringKey(vec!["browser-path", &browser_path_label], "").get_value(),
107 driver_mirror_url: StringKey(vec!["driver-mirror-url", &driver_mirror_label], "")
108 .get_value(),
109 browser_mirror_url: StringKey(vec!["browser-mirror-url", &browser_mirror_label], "")
110 .get_value(),
111 os: StringKey(vec!["os"], self_os).get_value(),
112 arch: StringKey(vec!["arch"], self_arch.as_str()).get_value(),
113 proxy: StringKey(vec!["proxy"], "").get_value(),
114 insecure: BooleanKey("insecure", false).get_value(),
115 timeout: IntegerKey("timeout", REQUEST_TIMEOUT_SEC).get_value(),
116 ttl: IntegerKey("ttl", TTL_SEC).get_value(),
117 offline: BooleanKey("offline", false).get_value(),
118 force_browser_download: BooleanKey("force-browser-download", false).get_value(),
119 avoid_browser_download: BooleanKey("avoid-browser-download", false).get_value(),
120 language_binding: StringKey(vec!["language-binding"], "").get_value(),
121 selenium_version: StringKey(vec!["selenium-version"], "").get_value(),
122 avoid_stats: should_avoid_stats(
123 BooleanKey("avoid-stats", cfg!(feature = "avoid_stats")).get_value(),
124 env::var(DO_NOT_TRACK).ok().as_deref(),
125 ),
126 skip_driver_in_path: BooleanKey("skip-driver-in-path", false).get_value(),
127 skip_browser_in_path: BooleanKey("skip-browser-in-path", false).get_value(),
128 }
129 }
130}

Callers

nothing calls this directly

Calls 11

StringKeyClass · 0.85
read_cache_pathFunction · 0.85
get_win_os_architectureFunction · 0.85
run_shell_commandFunction · 0.85
concatFunction · 0.85
BooleanKeyClass · 0.85
IntegerKeyClass · 0.85
should_avoid_statsFunction · 0.85
get_valueMethod · 0.80
okMethod · 0.80
isMethod · 0.65

Tested by

no test coverage detected