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

Method download_driver

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

Source from the content-addressed store, hash-verified

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

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
existsMethod · 0.80
get_http_clientMethod · 0.80
is_gridMethod · 0.80
get_osMethod · 0.80
get_loggerMethod · 0.45
debugMethod · 0.45
get_driver_urlMethod · 0.45
releaseMethod · 0.45