diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 8db0eff25..d24a0ba01 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -9,9 +9,9 @@ jobs: continue-on-error: true strategy: matrix: - python-version: [3.8, 3.11] # 3.12, pypy-3.9 - rf-version: [5.0.1, 6.1.1, 7.0] - selenium-version: [4.20.0, 4.21.0] + python-version: [3.8, 3.12] # pypy-3.9 + rf-version: [6.1.1, 7.0.1] + selenium-version: [4.21.0, 4.22.0, 4.23.1, 4.24.0] browser: [firefox, chrome, headlesschrome] #edge steps: @@ -60,11 +60,7 @@ jobs: pip install -U --pre robotframework==${{ matrix.rf-version }} - name: Install drivers via selenium-manager run: | - if [[ ${{ matrix.selenium-version }} == '4.20.0' || ${{ matrix.selenium-version }} == '4.21.0' ]]; then - SELENIUM_MANAGER_EXE=$(python -c 'from selenium.webdriver.common.selenium_manager import SeleniumManager; sm=SeleniumManager(); print(f"{str(sm._get_binary())}")') - else - SELENIUM_MANAGER_EXE=$(python -c 'from selenium.webdriver.common.selenium_manager import SeleniumManager; sm=SeleniumManager(); print(f"{str(sm.get_binary())}")') - fi + SELENIUM_MANAGER_EXE=$(python -c 'from selenium.webdriver.common.selenium_manager import SeleniumManager; sm=SeleniumManager(); print(f"{str(sm._get_binary())}")') echo "$SELENIUM_MANAGER_EXE" echo "WEBDRIVERPATH=$($SELENIUM_MANAGER_EXE --browser chrome --debug | awk '/INFO[[:space:]]Driver path:/ {print $NF;exit}')" >> "$GITHUB_ENV" echo "$WEBDRIVERPATH" diff --git a/README.rst b/README.rst index 85819fcab..727c8e705 100644 --- a/README.rst +++ b/README.rst @@ -10,7 +10,7 @@ SeleniumLibrary_ is a web testing library for `Robot Framework`_ that utilizes the Selenium_ tool internally. The project is hosted on GitHub_ and downloads can be found from PyPI_. -SeleniumLibrary currently works with Selenium 4. It supports Python 3.8 through 3.11. +SeleniumLibrary currently works with Selenium 4. It supports Python 3.8 through 3.12. In addition to the normal Python_ interpreter, it works also with PyPy_. diff --git a/atest/acceptance/keywords/async_javascript.robot b/atest/acceptance/keywords/async_javascript.robot index 7fc72b198..646e3dd16 100644 --- a/atest/acceptance/keywords/async_javascript.robot +++ b/atest/acceptance/keywords/async_javascript.robot @@ -88,6 +88,7 @@ Should Timeout If Script Does Not Invoke Callback With Long Timeout ... var callback = arguments[arguments.length - 1]; window.setTimeout(callback, 1500); Should Detect Page Loads While Waiting On An Async Script And Return An Error + [Tags] Triage Set Selenium Timeout 0.5 seconds ${status} ${error} Run Keyword And Ignore Error Execute Async Javascript ... window.location = 'javascript/dynamic'; diff --git a/setup.py b/setup.py index 8ddead98f..89d86d307 100755 --- a/setup.py +++ b/setup.py @@ -17,6 +17,7 @@ Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 +Programming Language :: Python :: 3.12 Programming Language :: Python :: 3 :: Only Topic :: Software Development :: Testing Framework :: Robot Framework @@ -41,7 +42,7 @@ keywords = 'robotframework testing testautomation selenium webdriver web', platforms = 'any', classifiers = CLASSIFIERS, - python_requires = '>=3.8, <3.12', + python_requires = '>=3.8, <=3.12', install_requires = REQUIREMENTS, package_dir = {'': 'src'}, packages = find_packages('src'), diff --git a/utest/test/keywords/approved_files/test_selenium_options_parser.test_parse_options_string_errors_py3_12.approved.txt b/utest/test/keywords/approved_files/test_selenium_options_parser.test_parse_options_string_errors_py3_12.approved.txt new file mode 100644 index 000000000..d57473c22 --- /dev/null +++ b/utest/test/keywords/approved_files/test_selenium_options_parser.test_parse_options_string_errors_py3_12.approved.txt @@ -0,0 +1,8 @@ +Selenium options string errors + +0) method("arg1) ('unterminated string literal (detected at line 1)', (1, 8)) +1) method(arg1") ('unterminated string literal (detected at line 1)', (1, 12)) +2) method(arg1) Unable to parse option: "method(arg1)" +3) attribute=arg1 Unable to parse option: "attribute=arg1" +4) attribute=webdriver Unable to parse option: "attribute=webdriver" +5) method(argument="value") Unable to parse option: "method(argument="value")" diff --git a/utest/test/keywords/approved_files/test_selenium_service_parser.test_parse_service_string_errors_py3_12.approved.txt b/utest/test/keywords/approved_files/test_selenium_service_parser.test_parse_service_string_errors_py3_12.approved.txt new file mode 100644 index 000000000..44dc032d0 --- /dev/null +++ b/utest/test/keywords/approved_files/test_selenium_service_parser.test_parse_service_string_errors_py3_12.approved.txt @@ -0,0 +1,8 @@ +Selenium service string errors + +0) attribute=arg1 Unable to parse service: "attribute=arg1" +1) attribute='arg1 ('unterminated string literal (detected at line 1)', (1, 11)) +2) attribute=['arg1' ('unexpected EOF in multi-line statement', (1, 0)) +3) attribute=['arg1';'arg2'] ('unexpected EOF in multi-line statement', (1, 0)) +4) attribute['arg1'] Unable to parse service: "attribute['arg1']" +5) attribute=['arg1'] attribute=['arg2'] Unable to parse service: "attribute=['arg1'] attribute=['arg2']" diff --git a/utest/test/keywords/test_selenium_options_parser.py b/utest/test/keywords/test_selenium_options_parser.py index 40e51bdd9..b61fff029 100644 --- a/utest/test/keywords/test_selenium_options_parser.py +++ b/utest/test/keywords/test_selenium_options_parser.py @@ -1,4 +1,5 @@ import os +import sys import unittest import pytest @@ -102,7 +103,8 @@ def test_parse_arguemnts(options, reporter): verify_all("Parse arguments from complex object", results, reporter=reporter) -@unittest.skipIf(WINDOWS, reason="ApprovalTest do not support different line feeds") +@pytest.mark.skipif(WINDOWS, reason="ApprovalTest do not support different line feeds") +@pytest.mark.skipif(sys.version_info > (3, 11), reason="Errors change with Python 3.12") def test_parse_options_string_errors(options, reporter): results = [] results.append(error_formatter(options._parse, 'method("arg1)', True)) @@ -114,6 +116,19 @@ def test_parse_options_string_errors(options, reporter): verify_all("Selenium options string errors", results, reporter=reporter) +@pytest.mark.skipif(WINDOWS, reason="ApprovalTest do not support different line feeds") +@pytest.mark.skipif(sys.version_info < (3, 12), reason="Errors change with Python 3.12") +def test_parse_options_string_errors_py3_12(options, reporter): + results = [] + results.append(error_formatter(options._parse, 'method("arg1)', True)) + results.append(error_formatter(options._parse, 'method(arg1")', True)) + results.append(error_formatter(options._parse, "method(arg1)", True)) + results.append(error_formatter(options._parse, "attribute=arg1", True)) + results.append(error_formatter(options._parse, "attribute=webdriver", True)) + results.append(error_formatter(options._parse, 'method(argument="value")', True)) + verify_all("Selenium options string errors", results, reporter=reporter) + + @unittest.skipIf(WINDOWS, reason="ApprovalTest do not support different line feeds") def test_split_options(options, reporter): results = [] @@ -203,8 +218,6 @@ def output_dir(): output_dir = os.path.abspath(os.path.join(curr_dir, "..", "..", "output_dir")) return output_dir -from selenium.webdriver.chrome.service import Service as ChromeService - def test_create_chrome_with_options(creator): options = mock() diff --git a/utest/test/keywords/test_selenium_service_parser.py b/utest/test/keywords/test_selenium_service_parser.py index 637a208c6..095a8c2c2 100644 --- a/utest/test/keywords/test_selenium_service_parser.py +++ b/utest/test/keywords/test_selenium_service_parser.py @@ -1,4 +1,5 @@ import os +import sys import unittest import pytest @@ -53,7 +54,10 @@ def test_parse_service_string(service, reporter): verify_all("Selenium service string to dict", results, reporter=reporter) -@unittest.skipIf(WINDOWS, reason="ApprovalTest do not support different line feeds") +# @unittest.skipIf(WINDOWS, reason="ApprovalTest do not support different line feeds") +# @unittest.skipIf(sys.version_info > (3, 11), reason="Errors change with Python 3.12") +@pytest.mark.skipif(WINDOWS, reason="ApprovalTest do not support different line feeds") +@pytest.mark.skipif(sys.version_info > (3, 11), reason="Errors change with Python 3.12") def test_parse_service_string_errors(service, reporter): results = [] results.append(error_formatter(service._parse, "attribute=arg1", True)) @@ -65,6 +69,19 @@ def test_parse_service_string_errors(service, reporter): verify_all("Selenium service string errors", results, reporter=reporter) +@pytest.mark.skipif(WINDOWS, reason="ApprovalTest do not support different line feeds") +@pytest.mark.skipif(sys.version_info < (3, 12), reason="Errors change with Python 3.12") +def test_parse_service_string_errors_py3_12(service, reporter): + results = [] + results.append(error_formatter(service._parse, "attribute=arg1", True)) + results.append(error_formatter(service._parse, "attribute='arg1", True)) + results.append(error_formatter(service._parse, "attribute=['arg1'", True)) + results.append(error_formatter(service._parse, "attribute=['arg1';'arg2']", True)) + results.append(error_formatter(service._parse, "attribute['arg1']", True)) + results.append(error_formatter(service._parse, "attribute=['arg1'] attribute=['arg2']", True)) + verify_all("Selenium service string errors", results, reporter=reporter) + + @unittest.skipIf(WINDOWS, reason="ApprovalTest do not support different line feeds") def test_split_service(service, reporter): results = []