diff --git a/.python-version b/.python-version index 543423dd..c8cfe395 100644 --- a/.python-version +++ b/.python-version @@ -1,4 +1 @@ -3.7.14 -3.8.14 -3.9.13 -3.10.8 +3.10 diff --git a/requirements-test.txt b/requirements-test.txt index 9d145d8c..84701082 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -3,8 +3,8 @@ psutil==5.9.2 pytest==7.0.1 pytest-timeout==2.1.0 -selenium==3.141.0 -webdriver_manager==3.7.1 +selenium>=4.0.0,<5.0.0 +webdriver_manager>=4.0.0,<5.0.0 mypy==0.971 pyinstaller==4.10 types-setuptools==67.2.0.1 diff --git a/tests/conftest.py b/tests/conftest.py index 92b16fab..e222ab58 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -4,7 +4,7 @@ import pytest from selenium import webdriver -from selenium.webdriver import DesiredCapabilities +from selenium.webdriver.chrome.service import Service as ChromeService from webdriver_manager.chrome import ChromeDriverManager @@ -14,18 +14,15 @@ def driver(): if TEST_BROWSER == "chrome": options = webdriver.ChromeOptions() - options.headless = True - capabilities = DesiredCapabilities.CHROME - capabilities["goog:loggingPrefs"] = {"browser": "ALL"} + options.add_argument('--headless=new') + options.set_capability("goog:loggingPrefs", {"browser": "ALL"}) if platform.system() == "Windows": options.binary_location = "C:/Program Files/Google/Chrome/Application/chrome.exe" driver = webdriver.Chrome( - ChromeDriverManager().install(), + service=ChromeService(ChromeDriverManager().install(), log_output=os.path.devnull), options=options, - desired_capabilities=capabilities, - service_log_path=os.path.devnull, ) # Firefox doesn't currently supported pulling JavaScript console logs, which we currently scan to affirm that diff --git a/tests/integration/test_examples.py b/tests/integration/test_examples.py index 6e51868d..53dff2a0 100644 --- a/tests/integration/test_examples.py +++ b/tests/integration/test_examples.py @@ -46,12 +46,12 @@ def test_04_file_access(driver: webdriver.Remote): assert driver.title == "Eel Demo" with TemporaryDirectory() as temp_dir, NamedTemporaryFile(dir=temp_dir) as temp_file: - driver.find_element_by_id('input-box').clear() - driver.find_element_by_id('input-box').send_keys(temp_dir) + driver.find_element(value='input-box').clear() + driver.find_element(value='input-box').send_keys(temp_dir) time.sleep(0.5) - driver.find_element_by_css_selector('button').click() + driver.find_element(By.CSS_SELECTOR, 'button').click() - assert driver.find_element_by_id('file-name').text == os.path.basename(temp_file.name) + assert driver.find_element(value='file-name').text == os.path.basename(temp_file.name) def test_06_jinja_templates(driver: webdriver.Remote): @@ -59,7 +59,7 @@ def test_06_jinja_templates(driver: webdriver.Remote): driver.get(eel_url) assert driver.title == "Hello, World!" - driver.find_element_by_css_selector('a').click() + driver.find_element(By.CSS_SELECTOR, 'a').click() WebDriverWait(driver, 2.0).until(expected_conditions.presence_of_element_located((By.XPATH, '//h1[text()="This is page 2"]')))