Skip to content

Commit 38dd912

Browse files
jimevansgsnedders
authored andcommitted
Updating browser version retrieval for Chrome to return None on Windows (web-platform-tests#11537)
The test framework attempts to retrieve the version of Chrome by executing `chrome --version` and parsing the result. On Windows, this command simply launches the browser. There may be tehcniques that can be used on Windows to get this information, including, but not limited to, reading the value from the Windows registry. This commit simply returns None for the browser version, which is a valid return value for this method, and will not adversely affect the execution of the test framework.
1 parent 7f0a106 commit 38dd912

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

tools/wpt/browser.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -367,16 +367,19 @@ def install_webdriver(self, dest=None):
367367

368368
def version(self, binary=None):
369369
binary = binary or self.binary
370-
try:
371-
version_string = call(binary, "--version").strip()
372-
except subprocess.CalledProcessError:
373-
logger.warn("Failed to call %s", binary)
374-
return None
375-
m = re.match(r"Google Chrome (.*)", version_string)
376-
if not m:
377-
logger.warn("Failed to extract version from: s%", version_string)
378-
return None
379-
return m.group(1)
370+
if uname[0] != "Windows":
371+
try:
372+
version_string = call(binary, "--version").strip()
373+
except subprocess.CalledProcessError:
374+
logger.warn("Failed to call %s", binary)
375+
return None
376+
m = re.match(r"Google Chrome (.*)", version_string)
377+
if not m:
378+
logger.warn("Failed to extract version from: s%", version_string)
379+
return None
380+
return m.group(1)
381+
logger.warn("Unable to extract version from binary on Windows.")
382+
return None
380383

381384

382385
class ChromeAndroid(Browser):

0 commit comments

Comments
 (0)