Skip to content

Commit

Permalink
Merge pull request #1916 from emanlove/python-3_12
Browse files Browse the repository at this point in the history
Python 3 12
  • Loading branch information
emanlove committed Sep 6, 2024
2 parents f74ea79 + 948332a commit c107110
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 14 deletions.
12 changes: 4 additions & 8 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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_.

Expand Down
1 change: 1 addition & 0 deletions atest/acceptance/keywords/async_javascript.robot
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'),
Expand Down
Original file line number Diff line number Diff line change
@@ -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")"
Original file line number Diff line number Diff line change
@@ -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']"
19 changes: 16 additions & 3 deletions utest/test/keywords/test_selenium_options_parser.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import sys
import unittest

import pytest
Expand Down Expand Up @@ -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))
Expand All @@ -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 = []
Expand Down Expand Up @@ -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()
Expand Down
19 changes: 18 additions & 1 deletion utest/test/keywords/test_selenium_service_parser.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import sys
import unittest

import pytest
Expand Down Expand Up @@ -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))
Expand All @@ -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 = []
Expand Down

0 comments on commit c107110

Please sign in to comment.