Skip to content
Open
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
3cf3262
Migrate from flake8 to Ruff for linting and formatting; update Python…
yuriverweij Apr 13, 2026
a401b04
Refactor and optimize code across multiple modules
yuriverweij Apr 25, 2026
9538508
Add early return in wait_until_location_is for improved flow control
yuriverweij Apr 25, 2026
a6e6f62
Refactor tests to use pytest and improve error handling
yuriverweij Apr 26, 2026
b68eb40
Update linting configuration and remove unnecessary skip conditions f…
yuriverweij Apr 26, 2026
d49a0c3
Add new test configuration for Firefox
yuriverweij Apr 26, 2026
e234c34
Fix variable interpolation in artifact name for better clarity
yuriverweij Apr 26, 2026
b33a8f1
Update linting and formatting workflows with new actions versions
yuriverweij Apr 26, 2026
b8a0d3e
Enhance browser opening logic to handle different browser names and p…
yuriverweij Apr 26, 2026
984d2a3
ruff format fixes
yuriverweij Apr 26, 2026
c3cad3f
Mouse Over error Firefox known issue
yuriverweij Apr 26, 2026
0261814
Update Ruff format check to include 'atest/' directory for comprehens…
yuriverweij Apr 26, 2026
da2f1b8
Update linting and formatting setup to use latest actions and enhance…
yuriverweij Apr 26, 2026
b8c1c5f
Add SKIP_ON_WINDOWS tag to relevant test cases and update run.py to e…
yuriverweij Apr 26, 2026
25da5f2
removed whitespace
yuriverweij Apr 26, 2026
6bec53f
fixes for copilot review comments.
yuriverweij Apr 26, 2026
1ab8845
fix: correct command for Ruff format check in workflow
yuriverweij Apr 26, 2026
57f3edf
chore: update Python, Robot Framework, and Selenium versions in CI wo…
yuriverweij Apr 26, 2026
068128b
fix: update Robot Framework version in CI and moved linting checks in…
yuriverweij Apr 26, 2026
4e638fb
fix: correct lint suppression comments
yuriverweij Apr 26, 2026
118cdd5
refactor: move Creator class definition inside creator function
yuriverweij Apr 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .flake8

This file was deleted.

1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.approved.txt text eol=lf
Comment thread
yuriverweij marked this conversation as resolved.
18 changes: 9 additions & 9 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
continue-on-error: true
strategy:
matrix:
python-version: [3.9.23, 3.13.5, 3.14.0-rc.3] # pypy-3.9
# python-version: [{earliest: 3.9}, {latest: 3.13.0}] # pypy-3.9
rf-version: [6.1.1, 7.3.2]
selenium-version: [4.28.1, 4.29.0, 4.30.0, 4.31.0, 4.32.0, 4.33.0, 4.34.2]
python-version: [3.10.16, 3.13.5, 3.14.4, pypy-3.10]
# python-version: [{earliest: 3.10}, {latest: 3.14.0-rc.3}, {pypy: pypy-3.10}]
rf-version: [6.1.1, 7.4.2]
selenium-version: [4.29.0, 4.30.0, 4.31.0, 4.32.0, 4.33.0, 4.34.2, 4.43.0]
browser: [chrome] # firefox, chrome, headlesschrome, edge

steps:
Expand Down Expand Up @@ -44,12 +44,12 @@ jobs:
export DISPLAY=:99.0
Xvfb -ac :99 -screen 0 1280x1024x16 > /dev/null 2>&1 &
- name: Install dependencies
if: matrix.python-version != 'pypy-3.7'
if: matrix.python-version != 'pypy-3.10'
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Install dependencies for pypy
if: matrix.python-version == 'pypy-3.9'
if: matrix.python-version == 'pypy-3.10'
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
Expand All @@ -68,7 +68,7 @@ jobs:
echo "WEBDRIVERPATH=$($SELENIUM_MANAGER_EXE --browser chrome --debug | awk '/INFO[[:space:]]Driver path:/ {print $NF;exit}')" >> "$GITHUB_ENV"
echo "$WEBDRIVERPATH"
- name: Generate stub file for ${{ matrix.python-version }}
if: matrix.python-version != 'pypy-3.9'
if: matrix.python-version != 'pypy-3.10'
run: |
invoke gen-stub

Expand All @@ -84,12 +84,12 @@ jobs:
# xvfb-run --auto-servernum python atest/run.py --zip ${{ matrix.browser }}

- name: Run tests with latest python and latest robot framework
if: matrix.python-version == '3.13.0' && matrix.rf-version == '7.2.2'
if: matrix.python-version == '3.14.4' && matrix.rf-version == '7.4.1'
run: |
xvfb-run --auto-servernum python atest/run.py --zip ${{ matrix.browser }}

# - name: Run tests with Selenium Grid
# if: matrix.python-version == '3.11' && matrix.rf-version == '3.2.2' && matrix.python-version != 'pypy-3.9'
# if: matrix.python-version == '3.11' && matrix.rf-version == '3.2.2' && matrix.python-version != 'pypy-3.10'
# run: |
# wget --no-verbose --output-document=./selenium-server-standalone.jar http://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar
# sudo chmod u+x ./selenium-server-standalone.jar
Expand Down
58 changes: 49 additions & 9 deletions .github/workflows/Select.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ jobs:
matrix:
config:
- description: latest
python-version: 3.13.10
rf-version: 7.4.1
selenium-version: 4.39.0
python-version: 3.14.4
rf-version: 7.4.2
selenium-version: 4.43.0
browser: chrome
- description: previous
python-version: 3.12.12
Expand All @@ -24,19 +24,23 @@ jobs:
rf-version: 6.1.1
selenium-version: 4.37.0
browser: chrome

- description: latest
python-version: 3.14.4
rf-version: 7.4.1
selenium-version: 4.39.0
browser: firefox
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Configuration Description
run: |
echo "${{ matrix.config.description }} configuration"
echo "Testing with RF v${{ matrix.config.rf-version }}, Selenium v${{ matrix.config.selenium-version}}, Python v${{ matrix.config.python-version }} under ${{ matrix.config.browser }}"
- name: Set up Python ${{ matrix.config.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.config.python-version }}
- name: Setup ${{ matrix.config.browser }} browser
uses: browser-actions/setup-chrome@v1
uses: browser-actions/setup-chrome@v2
with:
chrome-version: latest
install-dependencies: true
Expand Down Expand Up @@ -74,6 +78,42 @@ jobs:
- uses: actions/upload-artifact@v4
if: failure()
with:
name: sl_$${{ matrix.config.python-version }}_$${{ matrix.config.rf-version }}_$${{ matrix.config.selenium-version }}_$${{ matrix.config.browser }}
name: sl_${{ matrix.config.python-version }}_${{ matrix.config.rf-version }}_${{ matrix.config.selenium-version }}_${{ matrix.config.browser }}
path: atest/zip_results
overwrite: true
overwrite: true
ruff:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.14.4"

- name: Install dev dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt

- name: Ruff format check
id: format
continue-on-error: true
run: |
python -m invoke formatter --check

- name: Ruff lint
id: lint
continue-on-error: true
run: |
python -m invoke lint

- name: Fail if any Ruff step failed
if: always()
run: |
echo "format outcome: ${{ steps.format.outcome }}"
echo "lint outcome: ${{ steps.lint.outcome }}"
if [ "${{ steps.format.outcome }}" != "success" ] || [ "${{ steps.lint.outcome }}" != "success" ]; then
exit 1
fi
Comment thread
yuriverweij marked this conversation as resolved.
29 changes: 15 additions & 14 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -118,21 +118,23 @@ needed in internal code. When docstrings are added, they should follow
`PEP-257`_. See `Documentation`_ section below for more details about
documentation syntax, generating docs, etc.

The code should be formatted with `Black`_ and errors found by `flake8`_
should be fixed. Black and flake8 can be run by using
command::
The code should be formatted and linted with `Ruff`_. See Development commands below for more details.

inv lint
Development commands
~~~~~~~~~~~~~~~~~~~~

By default flake8 ignores line length error E501, but it does not ignore
warning W503. In practice Black formats list access like this::
Use `invoke`_ tasks for common local checks and test runs::

list[1 : 2]
inv formatter --check # Check formatting with Ruff
inv formatter # Format source files with Ruff
inv lint # Run Ruff lint checks
inv lint --fix # Apply safe Ruff lint fixes
inv utest # Run unit tests
inv atest # Run acceptance tests (headlesschrome)

But flake8 will display an warning about it. This should be manually
fixed to look like::

list[1:2]
Run these before opening a pull request so local results are close to CI.
Use the project virtual environment and pinned dependencies from
``requirements-dev.txt`` for consistent results across local runs and CI.

Documentation
-------------
Expand Down Expand Up @@ -160,7 +162,7 @@ individual keywords.

Keyword documentation can be easily created using `invoke`_ task::

inv keyword_documentation
inv kw-docs

Resulting docs should be verified before the code is committed.

Expand Down Expand Up @@ -245,5 +247,4 @@ the same code as your changes. In that case you should
.. _utest/README.rst: https://github.com/robotframework/SeleniumLibrary/blob/master/utest/README.rst
.. _sync your fork: https://help.github.com/articles/syncing-a-fork/
.. _resolve conflicts: https://help.github.com/articles/resolving-a-merge-conflict-from-the-command-line
.. _Black: https://github.com/psf/black
.. _flake8: https://github.com/PyCQA/flake8
.. _Ruff: https://github.com/astral-sh/ruff
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.13.
SeleniumLibrary currently works with Selenium 4. It supports Python 3.10 through 3.13.
In addition to the normal Python_ interpreter, it works also
with PyPy_.

Expand Down
7 changes: 6 additions & 1 deletion atest/acceptance/1-plugin/OpenBrowserExample.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,12 @@ def create_driver(
)

def create_seleniumwire(
self, desired_capabilities, remote_url, options=None, service_log_path=None, service=None,
self,
desired_capabilities,
remote_url,
options=None,
service_log_path=None,
service=None,
):
logger.info(self.extra_dictionary)
return webdriver.Chrome()
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ${event_firing_or_none} ${NONE}

*** Test Cases ***
Open Browser To Start Page
[Tags] NoGrid
[Tags] NoGrid SKIP_ON_WINDOWS
[Documentation]
... LOG 1:30 DEBUG Wrapping driver to event_firing_webdriver.
... LOG 1:32 INFO Got driver also from SeleniumLibrary.
Expand Down
2 changes: 1 addition & 1 deletion atest/acceptance/create_webdriver.robot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Create Webdriver Creates Functioning WebDriver
[Documentation]
... LOG 1:1 INFO REGEXP: Creating an instance of the \\w+ WebDriver.
... LOG 1:18 DEBUG REGEXP: Created \\w+ WebDriver instance with session id (\\w|-)+.
[Tags] Known Issue Internet Explorer Known Issue Safari
[Tags] Known Issue Internet Explorer Known Issue Safari SKIP_ON_WINDOWS
[Setup] Set Driver Variables
Create Webdriver ${DRIVER_NAME} kwargs=${KWARGS}
Go To ${FRONT_PAGE}
Expand Down
12 changes: 6 additions & 6 deletions atest/acceptance/entry_point.robot
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Entry Point Version
${process} = Run Process
... python -m SeleniumLibrary.entry --version
... shell=True
... cwd=${EXECDIR}/src
... cwd=${EXECDIR}${/}src
Log ${process.stdout}
Log ${process.stderr}
Should Be Equal As Integers ${process.rc} 0
Expand All @@ -17,18 +17,18 @@ Entry Point Version

Entry Point Translation
${process} = Run Process
... python -m SeleniumLibrary.entry translation ${OUTPUT_DIR}/translation.json
... python -m SeleniumLibrary.entry translation ${OUTPUT_DIR}${/}translation.json
... shell=True
... cwd=${EXECDIR}/src
... cwd=${EXECDIR}${/}src
Log ${process.stdout}
Log ${process.stderr}
Should Be Equal As Integers ${process.rc} 0
Should Be Empty ${process.stderr}
Should Be Equal ${process.stdout} Translation file created in ${OUTPUT_DIR}/translation.json
Should Be Equal ${process.stdout} Translation file created in ${OUTPUT_DIR}${/}translation.json
${process} = Run Process
... python -m SeleniumLibrary.entry translation --compare ${OUTPUT_DIR}/translation.json
... python -m SeleniumLibrary.entry translation --compare ${OUTPUT_DIR}${/}translation.json
... shell=True
... cwd=${EXECDIR}/src
... cwd=${EXECDIR}${/}src
Log ${process.stdout}
Log ${process.stderr}
Should Be Equal As Integers ${process.rc} 0
Expand Down
2 changes: 1 addition & 1 deletion atest/acceptance/keywords/mouse.robot
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Mouse Over
... Mouse Over not_there

Mouse Over Error
[Tags] Known Issue Safari
[Tags] Known Issue Safari Known Issue Firefox
Mouse Over el_for_mouseover
Sleep 0.1secs
Textfield Value Should Be el_for_mouseover mouseover el_for_mouseover
Expand Down
1 change: 1 addition & 0 deletions atest/acceptance/keywords/page_load_timeout.robot
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Test Teardown Close Browser And Reset Page Load Timeout

*** Test Cases ***
Should Open Browser With Default Page Load Timeout
[Tags] SKIP_ON_WINDOWS
[Documentation] Verify that 'Open Browser' changes the page load timeout.
... LOG 1.1.1:26 DEBUG REGEXP: POST http://localhost:\\d{2,5}/session/[a-f0-9-]+/timeouts {['\\\"]pageLoad['\\\"]: 300000}
... LOG 1.1.1:28 DEBUG STARTS: Remote response: status=200
Expand Down
9 changes: 7 additions & 2 deletions atest/acceptance/keywords/textfields.robot
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,10 @@ Attempt Clear Element Text On Non-Editable Field

Open Browser To Start Page Disabling Chrome Leaked Password Detection
[Arguments] ${alias}=${None}
Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL}
... options=add_experimental_option("prefs", {"profile.password_manager_leak_detection": False}) alias=${alias}
${browser}= Evaluate "${BROWSER}".replace(" ", "").lower()
IF "${browser}" in ["chrome", "googlechrome", "gc", "headlesschrome"]
Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL}
... options=add_experimental_option("prefs", {"profile.password_manager_leak_detection": False}) alias=${alias}
ELSE
Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} alias=${alias}
END
6 changes: 5 additions & 1 deletion atest/acceptance/multiple_browsers_options.robot
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ Documentation Creating test which would work on all browser is not possible.

*** Test Cases ***
Chrome Browser With Selenium Options As String
[Tags] SKIP_ON_WINDOWS
[Documentation]
... LOG 1:13 DEBUG REGEXP: .*['\\\"]goog:chromeOptions['\\\"].*
... LOG 1:13 DEBUG REGEXP: .*args['\\\"]: \\\[['\\\"]--disable-dev-shm-usage['\\\"].*
Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL}
... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument("--disable-dev-shm-usage")

Chrome Browser With Selenium Options As String With Attribute As True
[Tags] SKIP_ON_WINDOWS
[Documentation]
... LOG 1:13 DEBUG REGEXP: .*['\\\"]goog:chromeOptions['\\\"].*
... LOG 1:13 DEBUG REGEXP: .*args['\\\"]: \\\[['\\\"]--disable-dev-shm-usage['\\\"].*
Expand All @@ -23,7 +25,7 @@ Chrome Browser With Selenium Options As String With Attribute As True
... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument ( "--disable-dev-shm-usage" ) ; add_argument ( "--headless=new" )

Chrome Browser With Selenium Options With Complex Object
[Tags] NoGrid
[Tags] NoGrid SKIP_ON_WINDOWS
[Documentation]
... LOG 1:13 DEBUG REGEXP: .*['\\\"]goog:chromeOptions['\\\"].*
... LOG 1:13 DEBUG REGEXP: .*['\\\"]mobileEmulation['\\\"]: {['\\\"]deviceName['\\\"]: ['\\\"]Galaxy S5['\\\"].*
Expand All @@ -32,6 +34,7 @@ Chrome Browser With Selenium Options With Complex Object
... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument ( "--disable-dev-shm-usage" ) ; add_experimental_option( "mobileEmulation" , { 'deviceName' : 'Galaxy S5'})

Chrome Browser With Selenium Options Object
[Tags] SKIP_ON_WINDOWS
[Documentation]
... LOG 2:13 DEBUG REGEXP: .*['\\\"]goog:chromeOptions['\\\"].*
... LOG 2:13 DEBUG REGEXP: .*args['\\\"]: \\\[['\\\"]--disable-dev-shm-usage['\\\"].*
Expand All @@ -46,6 +49,7 @@ Chrome Browser With Selenium Options Invalid Method


Chrome Browser With Selenium Options Argument With Semicolon
[Tags] SKIP_ON_WINDOWS
[Documentation]
... LOG 1:13 DEBUG REGEXP: .*['\\\"]goog:chromeOptions['\\\"].*
... LOG 1:13 DEBUG REGEXP: .*\\\[['\\\"]has;semicolon['\\\"].*
Expand Down
4 changes: 4 additions & 0 deletions atest/acceptance/multiple_browsers_service.robot
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Suite Teardown Close All Browsers
Library ../resources/testlibs/get_driver_path.py
Resource resource.robot
Test Tags SKIP_ON_WINDOWS
# Force Tags Known Issue Firefox Known Issue Safari Known Issue Internet Explorer
Documentation Creating test which would work on all browser is not possible.
... These tests are for Chrome only.
Expand All @@ -11,18 +12,21 @@ Chrome Browser With Chrome Service As String
[Documentation]
... LOG 2:3 DEBUG STARTS: Started executable:
... LOG 2:4 DEBUG GLOB: POST*/session*
[Tags] Known Issue Firefox Known Issue Safari Known Issue Internet Explorer
${driver_path}= Get Driver Path Chrome
Open Browser ${FRONT PAGE} Chrome remote_url=${REMOTE_URL}
... service=executable_path='${driver_path}'

Chrome Browser With Chrome Service As String With service_args As List
[Tags] Known Issue Firefox Known Issue Safari Known Issue Internet Explorer
Open Browser ${FRONT PAGE} Chrome remote_url=${REMOTE_URL}
... service=service_args=['--append-log', '--readable-timestamp']; log_output='${OUTPUT_DIR}/chromedriverlog.txt'
File Should Exist ${OUTPUT_DIR}/chromedriverlog.txt
# ... service=service_args=['--append-log', '--readable-timestamp']; log_output='./'
# ... service=service_args=['--append-log', '--readable-timestamp']

Firefox Browser With Firefox Service As String
[Tags] Known Issue Chrome Known Issue Safari Known Issue Internet Explorer
[Documentation]
... LOG 2:3 DEBUG STARTS: Started executable:
... LOG 2:4 DEBUG GLOB: POST*/session*
Expand Down
1 change: 1 addition & 0 deletions atest/acceptance/open_and_close.robot
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Close Browser Does Nothing When No Browser Is Opened
Close Browser

Browser Open With Not Well-Formed URL Should Close
[Tags] SKIP_ON_WINDOWS
[Documentation] Verify after incomplete 'Open Browser' browser closes
... LOG 1.1:34 DEBUG STARTS: Opened browser with session id
... LOG 1.1:34 DEBUG REGEXP: .*but failed to open url.*
Expand Down
Loading