Skip to content

Commit

Permalink
gh SergeyPirogov#305 improved latest stable ver for UNKNOWN browser
Browse files Browse the repository at this point in the history
- MSEdge: when browser version was not determine - bound latest stable version to OS by major version.
  • Loading branch information
aleksandr-kotlyar committed Feb 15, 2022
1 parent f7a0855 commit b110a5e
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions webdriver_manager/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,19 +301,27 @@ def __init__(
)
self.browser_version = ""

def get_stable_release_version(self):
"""Stable driver version when browser version was not determined."""
self._latest_release_url.replace('LATEST_RELEASE', 'LATEST_STABLE')
resp = requests.get(self._latest_release_url, verify=self.ssl_verify)
validate_response(resp)
return resp.text.rstrip()

def get_latest_release_version(self) -> str:
self.browser_version = get_browser_version_from_os(ChromeType.MSEDGE)
log(f"Get LATEST {self._name} version for {self.browser_version} Edge")
major_edge_version = self.browser_version.split(".")[0] if self.browser_version != 'UNKNOWN' else None
latest_release_url = (
{
OSType.WIN in self.get_os_type(): f'{self._latest_release_url}_{major_edge_version}_WINDOWS',
OSType.MAC in self.get_os_type(): f'{self._latest_release_url}_{major_edge_version}_MACOS',
OSType.LINUX in self.get_os_type(): f'{self._latest_release_url}_{major_edge_version}_LINUX',
}[True]
if self.browser_version != "UNKNOWN"
else self._latest_release_url.replace('LATEST_RELEASE', 'LATEST_STABLE')
browser_version = get_browser_version_from_os(ChromeType.MSEDGE)
self.browser_version = (
browser_version
if browser_version != 'UNKNOWN'
else self.get_stable_release_version()
)
log(f"Get LATEST {self._name} version for {self.browser_version} Edge")
major_edge_version = self.browser_version.split(".")[0]
latest_release_url = {
OSType.WIN in self.get_os_type(): f'{self._latest_release_url}_{major_edge_version}_WINDOWS',
OSType.MAC in self.get_os_type(): f'{self._latest_release_url}_{major_edge_version}_MACOS',
OSType.LINUX in self.get_os_type(): f'{self._latest_release_url}_{major_edge_version}_LINUX',
}[True]
resp = requests.get(latest_release_url, verify=self.ssl_verify)
validate_response(resp)
self._version = resp.text.rstrip()
Expand Down

0 comments on commit b110a5e

Please sign in to comment.