Skip to content

Commit

Permalink
fixes with pytests
Browse files Browse the repository at this point in the history
  • Loading branch information
Svinokur committed Aug 13, 2024
1 parent 4ad6570 commit ab68379
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ This version was written and tested on Python 3.11.1

- Fixed an issue with incorrect extracting of tar.gz archives when specific filename is present
- Fixed an issue with incorrect extracting of chromedriver with third_party_notice file
- Fixed an issues with browsers versions checking

#### Removed

Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
[![Downloads](https://static.pepy.tech/badge/selenium-driver-updater/month)](https://pepy.tech/project/selenium-driver-updater)
[![Downloads](https://static.pepy.tech/badge/selenium-driver-updater/week)](https://pepy.tech/project/selenium-driver-updater)

[![Windows](https://github.com/Svinokur/selenium_driver_updater/actions/workflows/windows-tests.yml/badge.svg)](https://github.com/Svinokur/selenium_driver_updater/actions/workflows/windows-tests.yml)
[![macOS](https://github.com/Svinokur/selenium_driver_updater/actions/workflows/macOS-tests.yml/badge.svg)](https://github.com/Svinokur/selenium_driver_updater/actions/workflows/macOS-tests.yml)
[![Ubuntu](https://github.com/Svinokur/selenium_driver_updater/actions/workflows/ubuntu-tests.yml/badge.svg)](https://github.com/Svinokur/selenium_driver_updater/actions/workflows/ubuntu-tests.yml)
[![Build](https://github.com/Svinokur/selenium_driver_updater/actions/workflows/build.yml/badge.svg)](https://github.com/Svinokur/selenium_driver_updater/actions/workflows/build.yml)

It is a fast and convenience package that can automatically download or update Selenium webdriver binaries and their browsers for different OS.

Expand Down
5 changes: 4 additions & 1 deletion selenium_driver_updater/browsers/_edgeBrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from selenium import webdriver
from selenium.common.exceptions import SessionNotCreatedException
from selenium.common.exceptions import WebDriverException
from selenium.webdriver.edge.service import Service

# Local imports
from selenium_driver_updater._setting import setting
Expand Down Expand Up @@ -62,7 +63,9 @@ def _get_current_version_edge_browser_selenium(self) -> str:

desired_cap = {}

with webdriver.Edge(executable_path = self.edgedriver_path, capabilities=desired_cap) as driver:
service = Service(self.edgedriver_path)

with webdriver.Edge(service=service, capabilities=desired_cap) as driver:
browser_version = str(driver.capabilities['browserVersion'])

logger.info(f'Current version of edge browser: {browser_version}')
Expand Down
5 changes: 4 additions & 1 deletion selenium_driver_updater/browsers/_firefoxBrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from selenium.webdriver.firefox.options import Options as FirefoxOptions
from selenium.common.exceptions import SessionNotCreatedException
from selenium.common.exceptions import WebDriverException
from selenium.webdriver.firefox.service import Service

# Local imports
from selenium_driver_updater._setting import setting
Expand Down Expand Up @@ -74,7 +75,9 @@ def _get_current_version_firefox_browser_selenium(self) -> str:
options = FirefoxOptions()
options.add_argument("--headless")

with webdriver.Firefox(executable_path = self.geckodriver_path, options=options) as driver:
service = Service(self.geckodriver_path)

with webdriver.Firefox(service=service, options=options) as driver:
browser_version = str(driver.capabilities['browserVersion'])

logger.info(f'Current version of firefox browser: {browser_version}')
Expand Down
4 changes: 2 additions & 2 deletions selenium_driver_updater/test/edge_driver_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def test_check_download_driver_specific_version(setup_edgedriver):
edgedriver_path = edgedriver.driver_path
assert not Path(edgedriver_path).exists()

specific_version = '90.0.818.49'
specific_version = '128.0.2739.22'
file_name = edgedriver._download_driver(version=specific_version)
assert file_name is not None
assert len(file_name) > 0
Expand Down Expand Up @@ -163,7 +163,7 @@ def test_check_if_edgedriver_is_up_to_date(setup_edgedriver):

def test_check_if_version_is_valid(setup_edgedriver):
edgedriver, _, setting_local = setup_edgedriver
specific_version = '90.0.818.49'
specific_version = '128.0.2739.22'
url = str(setting_local["EdgeDriver"]["LinkLastReleaseFile"]).format(specific_version)

if 'mac64_m1' in url:
Expand Down

0 comments on commit ab68379

Please sign in to comment.