Skip to content

Commit

Permalink
Merge branch 'master' into new-attribute-property-keywords-1822
Browse files Browse the repository at this point in the history
  • Loading branch information
emanlove committed Dec 19, 2023
2 parents 7ab0a2c + fe01706 commit 085fc64
Show file tree
Hide file tree
Showing 22 changed files with 2,199 additions and 55 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ jobs:
strategy:
matrix:
python-version: [3.8, 3.11] # 3.12, pypy-3.9
rf-version: [4.1.3, 5.0.1, 6.0.1]
rf-version: [5.0.1, 6.1.1, 7.0b1]
selenium-version: [4.14.0, 4.15.2, 4.16.0]

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -42,6 +43,9 @@ jobs:
pip install -r requirements.txt
pip install robotstatuschecker>=1.4
pip install requests robotframework-pabot
- name: Install Seleninum v${{ matrix.selenium-version }}
run: |
pip install --upgrade selenium==${{ matrix.selenium-version }}
- name: Install RF ${{ matrix.rf-version }}
run: |
pip install -U --pre robotframework==${{ matrix.rf-version }}
Expand All @@ -56,6 +60,7 @@ jobs:
run: |
invoke gen-stub
# Temporarily ignoring pypy execution
- name: Run tests with headless Chrome and with PyPy
if: matrix.python-version == 'pypy-3.9'
run: |
Expand All @@ -78,7 +83,7 @@ jobs:
xvfb-run --auto-servernum python atest/run.py --zip firefox
# - name: Run tests with Selenium Grid
# if: matrix.python-version == '3.11' && matrix.rf-version == '3.2.2' && matrix.python-version != 'pypy-3.7'
# if: matrix.python-version == '3.11' && matrix.rf-version == '3.2.2' && matrix.python-version != 'pypy-3.9'
# 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 All @@ -87,5 +92,5 @@ jobs:
- uses: actions/upload-artifact@v1
if: success() || failure()
with:
name: Failed Test results
name: SeleniumLibrary Test results
path: atest/zip_results
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ different versions and the overall project history.
.. image:: https://img.shields.io/pypi/l/robotframework-seleniumlibrary.svg
:target: https://www.apache.org/licenses/LICENSE-2.0

.. image:: https://github.com/robotframework/SeleniumLibrary/workflows/SeleniumLibrary%20CI/badge.svg
:target: https://github.com/robotframework/SeleniumLibrary/actions?query=workflow%3A%22SeleniumLibrary+CI%22
.. image:: https://github.com/robotframework/SeleniumLibrary/actions/workflows/CI.yml/badge.svg?branch=master
:target: https://github.com/robotframework/SeleniumLibrary/actions/workflows/CI.yml

Keyword Documentation
---------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Library SeleniumLibrary event_firing_webdriver=${CURDIR}/../../resources/testlibs/MyListener.py
Resource resource_event_firing_webdriver.robot
Suite Setup Open Browser ${FRONT PAGE} ${BROWSER} alias=event_firing_webdriver
... remote_url=${REMOTE_URL} executable_path=%{WEBDRIVERPATH}
... remote_url=${REMOTE_URL}
Suite Teardown Close All Browsers

*** Variables ***
Expand All @@ -12,10 +12,9 @@ ${event_firing_or_none} ${NONE}
Open Browser To Start Page
[Tags] NoGrid
[Documentation]
... LOG 1:20 DEBUG Wrapping driver to event_firing_webdriver.
... LOG 1:22 INFO Got driver also from SeleniumLibrary.
... LOG 1:31 DEBUG Wrapping driver to event_firing_webdriver.
... LOG 1:33 INFO Got driver also from SeleniumLibrary.
Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL}
... executable_path=%{WEBDRIVERPATH}

Event Firing Webdriver Go To (WebDriver)
[Tags] NoGrid
Expand Down
8 changes: 8 additions & 0 deletions atest/acceptance/keywords/async_javascript.robot
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ Execute Async Javascript With ARGUMENTS and JAVASCRIPT Marker
... alert(arguments[0]);
Alert Should Be Present 123 timeout=10 s

Execute Javascript with dictionary object
&{ARGS}= Create Dictionary key=value number=${1} boolean=${TRUE}
${returned} Execute Async Javascript arguments[1](arguments[0]); ARGUMENTS ${ARGS}
Should Be True type($returned) == dict
Should Be Equal ${returned}[key] value
Should Be Equal ${returned}[number] ${1}
Should Be Equal ${returned}[boolean] ${TRUE}

Should Be Able To Return Javascript Primitives From Async Scripts Neither None Nor Undefined
${result} = Execute Async Javascript arguments[arguments.length - 1](123);
Should Be Equal ${result} ${123}
Expand Down
4 changes: 2 additions & 2 deletions atest/acceptance/keywords/cookies.robot
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,13 @@ Test Get Cookie Object Value
Test Get Cookie Keyword Logging
[Tags] NoGrid Known Issue Firefox
[Documentation]
... LOG 1:5 ${cookie} = name=far_future
... LOG 1:5 GLOB: ${cookie} = name=far_future
... value=timemachine
... path=/
... domain=localhost
... secure=False
... httpOnly=False
... expiry=2024-09-15 11:22:33
... expiry=2024-09-15 *:22:33
... extra={'sameSite': 'Lax'}
${cookie} = Get Cookie far_future

Expand Down
8 changes: 8 additions & 0 deletions atest/acceptance/keywords/javascript.robot
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@ Execute Javascript from File With ARGUMENTS Marker
... 123
Alert Should Be Present 123 timeout=10 s

Execute Javascript with dictionary object
&{ARGS}= Create Dictionary key=value number=${1} boolean=${TRUE}
${returned} Execute JavaScript return arguments[0] ARGUMENTS ${ARGS}
Should Be True type($returned) == dict
Should Be Equal ${returned}[key] value
Should Be Equal ${returned}[number] ${1}
Should Be Equal ${returned}[boolean] ${TRUE}

Open Context Menu
[Tags] Known Issue Safari
Go To Page "javascript/context_menu.html"
Expand Down
2 changes: 1 addition & 1 deletion atest/acceptance/keywords/textfields.robot
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Input Password Should Not Log Password String
... LOG 1:8 DEBUG STARTS: Remote response
... LOG 1:9 DEBUG Finished Request
... LOG 1:10 INFO Temporally setting log level to: NONE
... LOG 1:11 INFO Log level changed from NONE to DEBUG.
... LOG 1:11 ANY Log level changed from NONE to DEBUG.
... LOG 1:12 NONE
... LOG 2:1 INFO Typing text 'username' into text field 'username_field'.
Input Password password_field password
Expand Down
5 changes: 0 additions & 5 deletions atest/acceptance/locators/locator_parsing.robot
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ Multiple Locators with double arrows as separator should work
Multiple Locators strategy should be case-insensitive
Page Should Contain Element cSs=div#div_id >> XpaTh=a[6] >> iD=image1_id

Multiple Locators as a List should work
${element} = Get WebElement id:foo:bar
${locator_list} = Create List id:div_id ${element} id:bar=foo
Page Should Contain Element ${locator_list}

When One Of Locator From Multiple Locators Is Not Found Keyword Fails
Run Keyword And Expect Error
... Element with locator 'id:not_here' not found.
Expand Down
38 changes: 16 additions & 22 deletions atest/acceptance/multiple_browsers_options.robot
Original file line number Diff line number Diff line change
Expand Up @@ -9,51 +9,45 @@ Documentation Creating test which would work on all browser is not possible.
*** Test Cases ***
Chrome Browser With Selenium Options As String
[Documentation]
... LOG 1:3 DEBUG GLOB: *"goog:chromeOptions"*
... LOG 1:3 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?*
... LOG 1:14 DEBUG GLOB: *"goog:chromeOptions"*
... LOG 1:14 DEBUG GLOB: *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")
... executable_path=%{WEBDRIVERPATH}


Chrome Browser With Selenium Options As String With Attribute As True
[Documentation]
... LOG 1:3 DEBUG GLOB: *"goog:chromeOptions"*
... LOG 1:3 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?*
... LOG 1:3 DEBUG GLOB: *"--headless=new"*
... LOG 1:14 DEBUG GLOB: *"goog:chromeOptions"*
... LOG 1:14 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?*
... LOG 1:14 DEBUG GLOB: *"--headless=new"*
Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL}
... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument ( "--disable-dev-shm-usage" ) ; add_argument ( "--headless=new" )
... executable_path=%{WEBDRIVERPATH}


Chrome Browser With Selenium Options With Complex Object
[Tags] NoGrid
[Documentation]
... LOG 1:3 DEBUG GLOB: *"goog:chromeOptions"*
... LOG 1:3 DEBUG GLOB: *"mobileEmulation": {"deviceName": "Galaxy S5"*
... LOG 1:3 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?*
... LOG 1:14 DEBUG GLOB: *"goog:chromeOptions"*
... LOG 1:14 DEBUG GLOB: *"mobileEmulation": {"deviceName": "Galaxy S5"*
... LOG 1:14 DEBUG GLOB: *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" ) ; add_experimental_option( "mobileEmulation" , { 'deviceName' : 'Galaxy S5'})
... executable_path=%{WEBDRIVERPATH}


Chrome Browser With Selenium Options Object
[Documentation]
... LOG 2:3 DEBUG GLOB: *"goog:chromeOptions"*
... LOG 2:3 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?*
... LOG 2:14 DEBUG GLOB: *"goog:chromeOptions"*
... LOG 2:14 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?*
${options} = Get Chrome Options
Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL}
... desired_capabilities=${DESIRED_CAPABILITIES} options=${options}
... executable_path=%{WEBDRIVERPATH}


Chrome Browser With Selenium Options Invalid Method
Run Keyword And Expect Error AttributeError: 'Options' object has no attribute 'not_here_method'
... Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL}
... desired_capabilities=${DESIRED_CAPABILITIES} options=not_here_method("arg1")
... executable_path=%{WEBDRIVERPATH}


Chrome Browser With Selenium Options Argument With Semicolon
[Documentation]
... LOG 1:3 DEBUG GLOB: *"goog:chromeOptions"*
... LOG 1:3 DEBUG GLOB: *["has;semicolon"*
... LOG 1:14 DEBUG GLOB: *"goog:chromeOptions"*
... LOG 1:14 DEBUG GLOB: *["has;semicolon"*
Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL}
... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument("has;semicolon")
... executable_path=%{WEBDRIVERPATH}
6 changes: 3 additions & 3 deletions atest/acceptance/open_and_close.robot
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ Close Browser Does Nothing When No Browser Is Opened

Browser Open With Not Well-Formed URL Should Close
[Documentation] Verify after incomplete 'Open Browser' browser closes
... LOG 1.1:24 DEBUG STARTS: Opened browser with session id
... LOG 1.1:24 DEBUG REGEXP: .*but failed to open url.*
... LOG 1.1:35 DEBUG STARTS: Opened browser with session id
... LOG 1.1:35 DEBUG REGEXP: .*but failed to open url.*
... LOG 2:2 DEBUG STARTS: DELETE
... LOG 2:5 DEBUG STARTS: Finished Request
Run Keyword And Expect Error * Open Browser bad.url.bad ${BROWSER} executable_path=%{WEBDRIVERPATH}
Run Keyword And Expect Error * Open Browser bad.url.bad ${BROWSER}
Close All Browsers

Switch to closed browser is possible
Expand Down
25 changes: 25 additions & 0 deletions atest/acceptance/windows.robot
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,31 @@ Set Window Position using strings
Should Be Equal ${x} ${200}
Should Be Equal ${y} ${100}

Test Minimize and Maximize Will Actually Move and Resize Window
[Tags] Triage
Set Window Position 300 200
Set Window Size 400 300
${isHidden}= Execute Javascript return document.hidden;
Should Not Be True ${isHidden}

Minimize Browser Window

${isHidden}= Execute Javascript return document.hidden;
Should Be True ${isHidden}

Maximize Browser Window

${isHidden}= Execute Javascript return document.hidden;
Should Not Be True ${isHidden}

${x} ${y}= Get Window Position
${width} ${height}= Get Window Size
# Windows: Can't test for zero in multi-monitor setups
Should Not Be Equal ${x} ${300}
Should Not Be Equal ${y} ${200}
Should Be True ${width} > 400
Should Be True ${height} > 300

Select Window By Title After Close Window
[Tags] Known Issue Internet Explorer Known Issue Safari
Cannot Be Executed in IE
Expand Down
124 changes: 124 additions & 0 deletions docs/SeleniumLibrary-6.2.0.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
=====================
SeleniumLibrary 6.2.0
=====================


.. default-role:: code


SeleniumLibrary_ is a web testing library for `Robot Framework`_ that utilizes
the Selenium_ tool internally. SeleniumLibrary 6.2.0 is a new release with
compatibility fixes for recent selenium versions and some bug fixes.

If you have pip_ installed, just run

::

pip install --upgrade robotframework-seleniumlibrary

to install the latest available release or use

::

pip install robotframework-seleniumlibrary==6.2.0

to install exactly this version. Alternatively you can download the source
distribution from PyPI_ and install it manually.

SeleniumLibrary 6.2.0 was released on Friday November 24, 2023. SeleniumLibrary supports
Python 3.8 through 3.11, Selenium 4.12.0 through 4.15.2 and
Robot Framework 5.0.1 and 6.1.1.

.. _Robot Framework: http://robotframework.org
.. _SeleniumLibrary: https://github.com/robotframework/SeleniumLibrary
.. _Selenium: http://seleniumhq.org
.. _pip: http://pip-installer.org
.. _PyPI: https://pypi.python.org/pypi/robotframework-seleniumlibrary
.. _issue tracker: https://github.com/robotframework/SeleniumLibrary/issues?q=milestone%3Av6.2.0


.. contents::
:depth: 2
:local:

Most important enhancements
===========================

- Remove deprecated headless option for chrome and firefox. (`#1858`_)
If one specified either `headlesschrome` or `headlessfirefox` as the browser within the
Open Browser keyword, then the library would handle setting this option with the underlying
Selenium driver. But the methods to do so were depracted and then removed in Selenium
v4.13.0. Thus one was not getting a headless browser in these instances. This resolves that
issue.

- Resolve issue with service log_path now log_output. (`#1870`_)
Selenium changed the arguments for the service log within v4.13.0. This change allows for a
seamless usage across versions before and after v4.13.0.

- Execute JavaScript converts arguments to strings with robot==6.1 (`#1843`_)
If any ARGUMENTS were passed into either the `Execute Javascript` or `Execute Async Javascript`
then they were converted to strings even if they were of some other type. This has been
corrected within this release.

Acknowledgements
================

I want to thank the following for helping to get out this release,

- `René Rohner <https://github.com/Snooz82>`_ for pointing out that Create Webdriver had a
mutable default value (`#1817`_)
- `Kieran Trautwein <https://github.com/trauty-is-me>`_ for resolving the issue with
deprecated headless option for chrome and firefox. (`#1858`_)
- `Nicholas Bollweg <https://github.com/bollwyvl>`_ for assisting in resolving the issue
with service log_path now log_output. (`#1870`_)
- `Igor Kozyrenko <https://github.com/ikseek>`_ for reporting the argument issue with Execute
JavaScript and `René Rohner <https://github.com/Snooz82>`_for resolving it. (`#1843`_)
- `Robin Matz <https://github.com/robinmatz>`_ for improving the documentation on page load
timeout (`#1821`_)
- `Dor Blayzer <https://github.com/Dor-bl>`_ for reporting and fixing the SeleniumLibrary CI badge. ()

and **Yuri Verweij, Lisa Crispin, and Tatu Aalto**.

Full list of fixes and enhancements
===================================

.. list-table::
:header-rows: 1

* - ID
- Type
- Priority
- Summary
* - `#1817`_
- bug
- critical
- Create Webdriver has mutable default value
* - `#1858`_
- bug
- critical
- Remove deprecated headless option for chrome and firefox.
* - `#1870`_
- bug
- critical
- Resolve issue with service log_path now log_output.
* - `#1843`_
- bug
- high
- Execute JavaScript converts arguments to strings with robot==6.1
* - `#1821`_
- enhancement
- medium
- Improve documentation on page load timeout
* - `#1872`_
- ---
- medium
- fix: Selenium CI badge show wrong status

Altogether 6 issues. View on the `issue tracker <https://github.com/robotframework/SeleniumLibrary/issues?q=milestone%3Av6.2.0>`__.

.. _#1817: https://github.com/robotframework/SeleniumLibrary/issues/1817
.. _#1858: https://github.com/robotframework/SeleniumLibrary/issues/1858
.. _#1870: https://github.com/robotframework/SeleniumLibrary/issues/1870
.. _#1843: https://github.com/robotframework/SeleniumLibrary/issues/1843
.. _#1821: https://github.com/robotframework/SeleniumLibrary/issues/1821
.. _#1872: https://github.com/robotframework/SeleniumLibrary/issues/1872
Loading

0 comments on commit 085fc64

Please sign in to comment.