@@ -21,11 +21,12 @@ use std::collections::HashMap;
21
21
use std:: error:: Error ;
22
22
use std:: path:: PathBuf ;
23
23
24
- use crate :: files:: { compose_driver_path_in_cache, BrowserPath } ;
24
+ use crate :: files:: { compose_driver_path_in_cache, path_buf_to_string , BrowserPath } ;
25
25
26
26
use crate :: downloads:: parse_json_from_url;
27
27
use crate :: {
28
- create_http_client, parse_version, Logger , SeleniumManager , OFFLINE_REQUEST_ERR_MSG , WINDOWS ,
28
+ create_http_client, format_one_arg, parse_version, Logger , SeleniumManager ,
29
+ OFFLINE_REQUEST_ERR_MSG , REG_QUERY , STABLE , WINDOWS , WMIC_COMMAND ,
29
30
} ;
30
31
31
32
use crate :: metadata:: {
@@ -87,11 +88,37 @@ impl SeleniumManager for IExplorerManager {
87
88
}
88
89
89
90
fn get_browser_path_map ( & self ) -> HashMap < BrowserPath , & str > {
90
- HashMap :: new ( )
91
+ HashMap :: from ( [ (
92
+ BrowserPath :: new ( WINDOWS , STABLE ) ,
93
+ r#"Internet Explorer\iexplore.exe"# ,
94
+ ) ] )
91
95
}
92
96
93
97
fn discover_browser_version ( & mut self ) -> Option < String > {
94
- None
98
+ let commands;
99
+ let mut browser_path = self . get_browser_path ( ) . to_string ( ) ;
100
+ let escaped_browser_path;
101
+ if browser_path. is_empty ( ) {
102
+ match self . detect_browser_path ( ) {
103
+ Some ( path) => {
104
+ browser_path = path_buf_to_string ( path) ;
105
+ escaped_browser_path = self . get_escaped_path ( browser_path. to_string ( ) ) ;
106
+ commands = vec ! [ format_one_arg( WMIC_COMMAND , & escaped_browser_path) ] ;
107
+ }
108
+ None => {
109
+ commands = vec ! [
110
+ ( format_one_arg(
111
+ REG_QUERY ,
112
+ r#"HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer"# ,
113
+ ) ) ,
114
+ ] ;
115
+ }
116
+ }
117
+ } else {
118
+ escaped_browser_path = self . get_escaped_path ( browser_path. to_string ( ) ) ;
119
+ commands = vec ! [ format_one_arg( WMIC_COMMAND , & escaped_browser_path) ] ;
120
+ }
121
+ self . detect_browser_version ( commands)
95
122
}
96
123
97
124
fn get_driver_name ( & self ) -> & str {
0 commit comments