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

Method download_driver

rust/src/lib.rs:192–235  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

190 }
191
192 fn download_driver(&mut self) -> Result<(), Error> {
193 let driver_path_in_cache = self.get_driver_path_in_cache()?;
194 let driver_name_with_extension = self.get_driver_name_with_extension();
195
196 let mut lock = Lock::acquire(
197 self.get_logger(),
198 &driver_path_in_cache,
199 Some(driver_name_with_extension.clone()),
200 )?;
201 if !lock.exists() && driver_path_in_cache.exists() {
202 self.get_logger().debug(format!(
203 "Driver already in cache: {}",
204 driver_path_in_cache.display()
205 ));
206 return Ok(());
207 }
208
209 let driver_url = self.get_driver_url()?;
210 self.get_logger().debug(format!(
211 "Downloading {} {} from {}",
212 self.get_driver_name(),
213 self.get_driver_version(),
214 driver_url
215 ));
216 let (_tmp_folder, driver_zip_file) =
217 download_to_tmp_folder(self.get_http_client(), driver_url, self.get_logger())?;
218
219 if self.is_grid() {
220 let driver_path_in_cache = self.get_driver_path_in_cache()?;
221 file::move_file(driver_zip_file, driver_path_in_cache, &CopyOptions::new())?;
222 } else {
223 uncompress(
224 &driver_zip_file,
225 &driver_path_in_cache,
226 self.get_logger(),
227 self.get_os(),
228 Some(driver_name_with_extension),
229 None,
230 )?;
231 }
232
233 lock.release();
234 Ok(())
235 }
236
237 fn download_browser(
238 &mut self,

Callers 1

setupMethod · 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 12

download_to_tmp_folderFunction · 0.85
uncompressFunction · 0.85
is_gridMethod · 0.80
get_osMethod · 0.80
get_loggerMethod · 0.45
existsMethod · 0.45
debugMethod · 0.45
get_driver_urlMethod · 0.45
get_http_clientMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected