diff --git a/tests/test_chrome_driver.py b/tests/test_chrome_driver.py index f465d6fe..fa2096bf 100644 --- a/tests/test_chrome_driver.py +++ b/tests/test_chrome_driver.py @@ -1,10 +1,11 @@ import json import os - +import platform +from random import random import pytest import browsers from selenium import webdriver -from mock import patch +from mock import patch, create_autospec from webdriver_manager.chrome import ChromeDriverManager from webdriver_manager.core.constants import ROOT_FOLDER_NAME @@ -105,3 +106,29 @@ def test_chrome_manager_cached_driver_with_selenium(): def test_can_get_chrome_for_os(os_type): path = ChromeDriverManager(os_system_manager=OperationSystemManager(os_type)).install() assert os.path.exists(path) + + +def test_can_get_chrome_for_win64(delete_drivers_dir): + os_sys_manager = OperationSystemManager("win64") + path = ChromeDriverManager(os_system_manager=os_sys_manager).install() + assert os.path.basename(os.path.dirname(path)) == "chromedriver-win64" + + +def test_can_get_chrome_for_win32(delete_drivers_dir): + os_sys_manager = OperationSystemManager("win32") + path = ChromeDriverManager(os_system_manager=os_sys_manager).install() + assert os.path.basename(os.path.dirname(path)) == "chromedriver-win32" + + +@patch("webdriver_manager.core.os_manager.platform") +def test_can_get_chrome_for_mac64(mock_platform, delete_drivers_dir): + mock_platform.processor = create_autospec(platform.processor, return_value="i386") + os_sys_manager = OperationSystemManager("mac64") + path = ChromeDriverManager(os_system_manager=os_sys_manager).install() + assert os.path.basename(os.path.dirname(path)) == "chromedriver-mac-x64" + + +def test_can_get_chrome_for_mac64_m1(delete_drivers_dir): + os_sys_manager = OperationSystemManager("mac64_m1") + path = ChromeDriverManager(os_system_manager=os_sys_manager).install() + assert os.path.basename(os.path.dirname(path)) == "chromedriver-mac-arm64" diff --git a/webdriver_manager/chrome.py b/webdriver_manager/chrome.py index d8a91bf0..f2e6b71a 100644 --- a/webdriver_manager/chrome.py +++ b/webdriver_manager/chrome.py @@ -43,8 +43,8 @@ def install(self) -> str: def get_os_type(self): os_type = super().get_os_type() - if "win" in os_type: - return "win32" + if os_type in ["win32", "win64"]: + return os_type if not self._os_system_manager.is_mac_os(os_type): return os_type