File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -231,6 +231,7 @@ def get_binary_location(browser_type, prefer_chromium=False):
231
231
232
232
def get_browser_version_from_binary (binary_location ):
233
233
try :
234
+ path = binary_location
234
235
if binary_location .count (r"\ " ) != binary_location .count (" " ):
235
236
binary_location = binary_location .replace (" " , r"\ " )
236
237
cmd_mapping = binary_location + " --version"
@@ -240,6 +241,16 @@ def get_browser_version_from_binary(binary_location):
240
241
if quad_version and len (str (quad_version )) >= 9 : # Eg. 115.0.0.0
241
242
return quad_version
242
243
version = read_version_from_cmd (cmd_mapping , pattern )
244
+ if not version and os_name () == OSType .WIN and os .path .exists (path ):
245
+ path = path .replace (r"\ " , r" " ).replace ("\\ " , "\\ \\ " )
246
+ cmd_mapping = (
247
+ '''powershell -command "&{(Get-Item '%s')'''
248
+ '''.VersionInfo.ProductVersion}"''' % path
249
+ )
250
+ quad_version = read_version_from_cmd (cmd_mapping , quad_pattern )
251
+ if quad_version and len (str (quad_version )) >= 9 :
252
+ return quad_version
253
+ version = read_version_from_cmd (cmd_mapping , pattern )
243
254
return version
244
255
except Exception :
245
256
return None
You can’t perform that action at this time.
0 commit comments