Skip to content

Commit

Permalink
Add ChromeiOS version support (#45326)
Browse files Browse the repository at this point in the history
* Add ChromeiOS version support

* fix

* fix

* fix
  • Loading branch information
sj0602 committed Mar 26, 2024
1 parent 37583a6 commit b847b10
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion tools/wpt/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1559,7 +1559,23 @@ def install_webdriver(self, dest=None, channel=None, browser_binary=None):
raise NotImplementedError

def version(self, binary=None, webdriver_binary=None):
return None
if webdriver_binary is None:
self.logger.warning(
"Cannot find ChromeiOS version without CWTChromeDriver")
return None
# Use `chrome iOS driver --version` to get the version. Example output:
# "125.0.6378.0"
try:
version_string = call(webdriver_binary, "--version").strip()
except subprocess.CalledProcessError as e:
self.logger.warning(f"Failed to call {webdriver_binary}: {e}")
return None
m = re.match(r"[\d][\d\.]*", version_string)
if not m:
self.logger.warning(
f"Failed to extract version from: {version_string}")
return None
return m.group(0)


class Opera(Browser):
Expand Down

0 comments on commit b847b10

Please sign in to comment.