Skip to content

Commit

Permalink
see version 5.1.2 changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
Svinokur committed Oct 28, 2021
1 parent e370876 commit 8333156
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 11 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ This version was written and tested on Python 3.9.6
### Fixes

- Fixed an issue where the previous latest version was incorrectly received through the github site
- Fixed an issue with incorrect getting of phantomjs versions via github releases
- Fixed an issue if browser is not pre installed and could not be updated
- Fixed an issue with incorrect getting of latest previous version of edgedriver

## [5.1.1] - 25/09/2021
This version was written and tested on Python 3.9.6
Expand Down
6 changes: 3 additions & 3 deletions selenium_driver_updater/_edgeDriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

# Third party imports
import wget
import re

# Local imports

Expand Down Expand Up @@ -112,11 +113,10 @@ def _get_latest_previous_version_edgedriver_via_requests(self) -> str:
latest_version_main = int(latest_version.split('.', maxsplit=1)[0])
latest_previous_version_main = str(latest_version_main-1)

url = self.setting["EdgeDriver"]["LinkLatestReleaseSpecificVersion"].format(latest_previous_version_main)

url = self.setting["EdgeDriver"]["LinkLatestReleaseSpecificVersion"]
json_data = self.requests_getter.get_result_by_request(url=url)

latest_previous_version = str(json_data.strip())
latest_previous_version = [version for version in re.findall(self.setting["Program"]["wedriverVersionPattern"], json_data) if version.startswith(latest_previous_version_main)][-1]

logger.info(f'Latest previous version of edgedriver: {latest_previous_version}')

Expand Down
4 changes: 2 additions & 2 deletions selenium_driver_updater/_setting.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@

@dataclass
class info:
version = "5.1.1"
version = "5.1.2"

setting = dict(
{
Expand Down Expand Up @@ -117,7 +117,7 @@ class info:
"LinkLastReleaseFile" : edgedriver_latest_release,
"LastReleasePlatform" : 'msedgedriver',
"LinkCheckVersionIsValid" : "https://msedgewebdriverstorage.blob.core.windows.net/edgewebdriver?prefix={}%2F&delimiter=%2F&maxresults=100&restype=container&comp=list&_=1622714933676&timeout=60000",
"LinkLatestReleaseSpecificVersion" : "https://msedgewebdriverstorage.blob.core.windows.net/edgewebdriver/LATEST_RELEASE_{}",
"LinkLatestReleaseSpecificVersion" : "https://msedgedriver.azureedge.net",
},
"PhantomJS":
{
Expand Down
3 changes: 2 additions & 1 deletion selenium_driver_updater/browsers/_edgeBrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ def _get_latest_edge_browser_for_current_os(self) -> None:

edge_browser_path_application = '/Applications/Microsoft Edge.app'

shutil.rmtree(edge_browser_path_application)
if Path(edge_browser_path_application).exists():
shutil.rmtree(edge_browser_path_application)
shutil.move(edge_browser_path, edge_browser_path_application)

logger.info(f'Successfully moved edge browser from: {edge_browser_path} to: {edge_browser_path_application}')
Expand Down
3 changes: 2 additions & 1 deletion selenium_driver_updater/browsers/_operaBrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ def _get_latest_opera_browser_for_current_os(self) -> None:
opera_browser_path = path + 'Opera.app'
opera_browser_path_application = '/Applications/Opera.app'

shutil.rmtree(opera_browser_path_application)
if Path(opera_browser_path_application).exists():
shutil.rmtree(opera_browser_path_application)
shutil.move(opera_browser_path, opera_browser_path_application)

logger.info(f'Successfully moved opera browser from: {opera_browser_path} to: {opera_browser_path_application}')
Expand Down
Binary file modified selenium_driver_updater/test/drivers/chromedriver_test
Binary file not shown.
Binary file modified selenium_driver_updater/test/drivers/edgedriver_test
Binary file not shown.
Binary file modified selenium_driver_updater/test/drivers/operadriver_test
Binary file not shown.
2 changes: 1 addition & 1 deletion selenium_driver_updater/test/settingTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def test03_check_values_params(self):
self.assertEqual(self.setting["EdgeDriver"]["LinkLastReleaseFile"], edgedriver_latest_release)
self.assertEqual(self.setting["EdgeDriver"]["LastReleasePlatform"], 'msedgedriver')
self.assertEqual(self.setting["EdgeDriver"]["LinkCheckVersionIsValid"], "https://msedgewebdriverstorage.blob.core.windows.net/edgewebdriver?prefix={}%2F&delimiter=%2F&maxresults=100&restype=container&comp=list&_=1622714933676&timeout=60000")
self.assertEqual(self.setting["EdgeDriver"]["LinkLatestReleaseSpecificVersion"], "https://msedgewebdriverstorage.blob.core.windows.net/edgewebdriver/LATEST_RELEASE_{}")
self.assertEqual(self.setting["EdgeDriver"]["LinkLatestReleaseSpecificVersion"], "https://msedgedriver.azureedge.net")

self.assertEqual(self.setting["PhantomJS"]["LinkLastReleaseFile"], phantomjs_latest_release)
self.assertEqual(self.setting["PhantomJS"]["LastReleasePlatform"], 'phantomjs')
Expand Down
16 changes: 14 additions & 2 deletions selenium_driver_updater/util/github_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,25 @@ def get_release_version_by_repo_name_via_site(repo_name: str, index:int = 0) ->
json_data : All latest release data.
"""

url: str = f'https://github.com/{repo_name}/releases'
url: str = str(setting["Github"]["linkAllReleases"]).format(repo_name)
version:str = ''

json_data = RequestsGetter.get_result_by_request(url=url)

soup = BeautifulSoup(json_data, 'html.parser')
version = soup.findAll('a', href=lambda href: href and 'releases/tag' in href)[index].text.strip()
try:
version = soup.findAll('a', href=lambda href: href and 'releases/tag' in href)[index].text.strip()
except IndexError:
logger.error('Could not retrieve version via releases, trying to retrieve version via tags')
url: str = 'https://github.com/{}/tags'.format(repo_name)

json_data = RequestsGetter.get_result_by_request(url=url)

soup = BeautifulSoup(json_data, 'html.parser')

version_tag = soup.findAll('a', href=lambda href: href and 'releases/tag' in href)[index].text.strip()

version = re.findall(setting["Program"]["wedriverVersionPattern"], str(version_tag))[0]

return version

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

setup(
name='selenium_driver_updater',
version='5.1.1',
version='5.1.2',
description='Download or update your Selenium driver binaries and their browsers automatically with this package',
long_description=long_description,
long_description_content_type='text/markdown',
Expand Down

0 comments on commit 8333156

Please sign in to comment.