@@ -1083,6 +1083,12 @@ pub trait SeleniumManager {
10831083 if let Some ( path) = self . detect_browser_path ( ) {
10841084 browser_path = path_to_string ( & path) ;
10851085 }
1086+ } else if !Path :: new ( & browser_path) . exists ( ) {
1087+ self . set_fallback_driver_from_cache ( false ) ;
1088+ return Err ( anyhow ! ( format_one_arg(
1089+ "Browser path does not exist: {}" ,
1090+ & browser_path,
1091+ ) ) ) ;
10861092 }
10871093 let escaped_browser_path = self . get_escaped_path ( browser_path. to_string ( ) ) ;
10881094
@@ -1288,6 +1294,26 @@ pub trait SeleniumManager {
12881294 }
12891295 }
12901296
1297+ fn get_driver_mirror_versions_url_or_default < ' a > ( & ' a self , default_url : & ' a str ) -> String {
1298+ let driver_mirror_url = self . get_driver_mirror_url ( ) ;
1299+ if !driver_mirror_url. is_empty ( ) {
1300+ let driver_versions_path = default_url. rfind ( '/' ) . map ( |i| & default_url[ i + 1 ..] ) ;
1301+ if let Some ( path) = driver_versions_path {
1302+ let driver_mirror_versions_url = if driver_mirror_url. ends_with ( '/' ) {
1303+ format ! ( "{}{}" , driver_mirror_url, path)
1304+ } else {
1305+ format ! ( "{}/{}" , driver_mirror_url, path)
1306+ } ;
1307+ self . get_logger ( ) . debug ( format ! (
1308+ "Using mirror URL to discover driver versions: {}" ,
1309+ driver_mirror_versions_url
1310+ ) ) ;
1311+ return driver_mirror_versions_url;
1312+ }
1313+ }
1314+ default_url. to_string ( )
1315+ }
1316+
12911317 fn get_driver_mirror_url_or_default < ' a > ( & ' a self , default_url : & ' a str ) -> String {
12921318 self . get_url_or_default ( self . get_driver_mirror_url ( ) , default_url)
12931319 }
@@ -1504,6 +1530,14 @@ pub trait SeleniumManager {
15041530 self . get_config_mut ( ) . avoid_stats = true ;
15051531 }
15061532 }
1533+
1534+ fn is_fallback_driver_from_cache ( & self ) -> bool {
1535+ self . get_config ( ) . fallback_driver_from_cache
1536+ }
1537+
1538+ fn set_fallback_driver_from_cache ( & mut self , fallback_driver_from_cache : bool ) {
1539+ self . get_config_mut ( ) . fallback_driver_from_cache = fallback_driver_from_cache;
1540+ }
15071541}
15081542
15091543// ----------------------------------------------------------
0 commit comments