From b0210b301ab6e85d9bf7f86493aee2074ec91a69 Mon Sep 17 00:00:00 2001 From: Anilabha Datta Date: Fri, 15 Mar 2024 03:47:06 +0530 Subject: [PATCH] update: get binary version of chrome in windows --- seleniumbase/core/detect_b_ver.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/seleniumbase/core/detect_b_ver.py b/seleniumbase/core/detect_b_ver.py index 8e728829308..689d48a8d66 100644 --- a/seleniumbase/core/detect_b_ver.py +++ b/seleniumbase/core/detect_b_ver.py @@ -7,6 +7,8 @@ import subprocess import sys +from seleniumbase.fixtures import shared_utils + class File(object): def __init__(self, stream): @@ -233,7 +235,10 @@ def get_browser_version_from_binary(binary_location): try: if binary_location.count(r"\ ") != binary_location.count(" "): binary_location = binary_location.replace(" ", r"\ ") - cmd_mapping = binary_location + " --version" + if shared_utils.is_windows(): + binary_location = f'powershell -command "&{{(Get-Item {binary_location}).VersionInfo.ProductVersion}}"' + else: + cmd_mapping = binary_location + " --version" pattern = r"\d+\.\d+\.\d+" quad_pattern = r"\d+\.\d+\.\d+\.\d+" quad_version = read_version_from_cmd(cmd_mapping, quad_pattern)