Skip to content

Commit 5a38cd4

Browse files
Merge pull request #1 from robotframework/master
merge rf-sl
2 parents 895c1d6 + 8640b2e commit 5a38cd4

File tree

108 files changed

+6068
-2728
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+6068
-2728
lines changed

.github/workflows/CI.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: SeleniumLibrary CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
python-version: [3.6, 3.8, pypy3]
12+
rf-version: [3.1.2, 3.2.1]
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Set up Python ${{ matrix.python-version }} with Robot Framework ${{ matrix.rf-version }}
17+
uses: actions/setup-python@v1
18+
with:
19+
python-version: ${{ matrix.python-version }}
20+
- name: Start xvfb
21+
run: |
22+
export DISPLAY=:99.0
23+
Xvfb -ac :99 -screen 0 1280x1024x16 > /dev/null 2>&1 &
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install -r requirements-dev.txt
28+
- name: Install RF ${{ matrix.rf-version }}
29+
run: |
30+
pip install -U --pre robotframework==${{ matrix.rf-version }}
31+
- name: Run tests with headless Chrome and with Python != 3.8
32+
if: matrix.python-version != '3.8'
33+
run: |
34+
xvfb-run --auto-servernum python atest/run.py --zip headlesschrome
35+
- name: Run tests normal Chrome with Python 3.8
36+
if: matrix.python-version == '3.8' && matrix.rf-version != '3.1.2'
37+
run: |
38+
xvfb-run --auto-servernum python atest/run.py --zip chrome
39+
- name: Run tests with Selenium Grid
40+
if: matrix.python-version == '3.8' && matrix.rf-version == '3.1.2'
41+
run: |
42+
wget --no-verbose --output-document=./selenium-server-standalone.jar http://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar
43+
sudo chmod u+x ./selenium-server-standalone.jar
44+
xvfb-run --auto-servernum python atest/run.py --zip headlesschrome --grid True
45+
- uses: actions/upload-artifact@v1
46+
if: success() || failure()
47+
with:
48+
name: Failed Test results
49+
path: atest/zip_results

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
.pydevproject
33
.idea
44
atest/results
5+
atest/zip_results
56
utest/output_dir
67
*.pyc
78
*.orig
@@ -10,6 +11,8 @@ MANIFEST
1011
*.egg-info
1112
*.egg
1213
chromedriver.log
14+
.pytest_cache
1315

1416
dist
1517
build
18+
.pabotsuitenames

.travis.yml

Lines changed: 0 additions & 80 deletions
This file was deleted.

README.rst

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ SeleniumLibrary_ is a web testing library for `Robot Framework`_ that
1010
utilizes the Selenium_ tool internally. The project is hosted on GitHub_
1111
and downloads can be found from PyPI_.
1212

13-
SeleniumLibrary works with Selenium 3. It supports Python 2.7 as well as
14-
Python 3.4 or newer. In addition to the normal Python_ interpreter, it
13+
SeleniumLibrary works with Selenium 3 and 4. It supports Python 2.7 as well as
14+
Python 3.6 or newer. In addition to the normal Python_ interpreter, it
1515
works also with PyPy_ and Jython_. Unfortunately Selenium_ is not
1616
currently supported by IronPython_ and thus this library does not work with
1717
IronPython either.
@@ -23,12 +23,15 @@ different versions and the overall project history.
2323

2424
.. image:: https://img.shields.io/pypi/v/robotframework-seleniumlibrary.svg?label=version
2525
:target: https://pypi.python.org/pypi/robotframework-seleniumlibrary
26+
27+
.. image:: https://img.shields.io/pypi/dm/robotframework-seleniumlibrary.svg
28+
:target: https://pypi.python.org/pypi/robotframework-seleniumlibrary
2629

2730
.. image:: https://img.shields.io/pypi/l/robotframework-seleniumlibrary.svg
2831
:target: https://www.apache.org/licenses/LICENSE-2.0
2932

30-
.. image:: https://api.travis-ci.org/robotframework/SeleniumLibrary.png
31-
:target: https://travis-ci.org/robotframework/SeleniumLibrary
33+
.. image:: https://github.com/robotframework/SeleniumLibrary/workflows/SeleniumLibrary%20CI/badge.svg
34+
:target: https://github.com/robotframework/SeleniumLibrary/actions?query=workflow%3A%22SeleniumLibrary+CI%22
3235

3336
Keyword documentation
3437
---------------------
@@ -220,6 +223,9 @@ Selenium2Library 1.8.0 and earlier Selenium 2 and 3 Python 2.6-2.7
220223
SeleniumLibrary 3.0 and 3.1 Selenium 2 and 3 Python 2.7 and 3.3+ Selenium2Library renamed and with Python 3 support and new architecture.
221224
SeleniumLibrary 3.2 Selenium 3 Python 2.7 and 3.4+ Drops Selenium 2 support.
222225
SeleniumLibrary 4.0 Selenium 3 Python 2.7 and 3.4+ Plugin API and support for event friging webdriver.
226+
SeleniumLibrary 4.1 Selenium 3 Python 2.7 and 3.5+ Drops Python 3.4 support.
227+
SeleniumLibrary 4.2 Selenium 3 Python 2.7 and 3.5+ Supports only Selenium 3.141.0 or newer.
228+
SeleniumLibrary 4.4 Selenium 3 and 4 Python 2.7 and 3.6+ New PythonLibCore and dropped Python 3.5 support.
223229
Selenium2Library 3.0 Depends on SeleniumLibrary Depends on SeleniumLibrary Thin wrapper for SeleniumLibrary 3.0 to ease transition.
224230
================================== ========================== ========================== ===============
225231

@@ -263,7 +269,7 @@ Going forward, all new development will happen in the new SeleniumLibrary
263269
project.
264270

265271
.. _Robot Framework: https://robotframework.org
266-
.. _Selenium: https://seleniumhq.org
272+
.. _Selenium: https://www.seleniumhq.org/
267273
.. _SeleniumLibrary: https://github.com/robotframework/SeleniumLibrary
268274
.. _Selenium2Library: https://github.com/robotframework/Selenium2Library
269275
.. _Old SeleniumLibrary: https://github.com/robotframework/OldSeleniumLibrary

atest/README.rst

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,21 @@ system settings, which python is used by default. It is possible to run test
3636
by using different interpreter by using the `--interpreter` command line
3737
argument.
3838

39+
Running test with Selenium Grid
40+
-------------------------------
41+
It is possible to run test by using `Selenium Grid`_ if keywords contains
42+
some grid specific implementation. Running test Selenium Grid requires
43+
that latest released selenium-server-standalone-*.jar is downloaded
44+
in the project root and Java is installed. The `run.py` will start and
45+
stop Selenium servers automatically. The testing with Selenium Grid
46+
can done by using `--grid true` argument. In some cases Selenium Grid adds
47+
some extra logging and causes test to fail when `robotstatuschecker`_ is
48+
used. In this case, these test should be tagged with `NoGrid` tag to
49+
exclude the test when Selenium Grid is being used. Also there might
50+
be need write test that are only run when Selenium Grid is used.
51+
Then in this case, test should be tagged with `OnlyGrid` tag to
52+
include them only when Selenium Grid is used.
53+
3954
Robot Framework command line arguments
4055
--------------------------------------
4156
It is possible to pass Robot Framework command line arguments to the test
@@ -44,26 +59,13 @@ to use arguments to select required suite or test for the execution when
4459
developing new functionality for the library. Example like --test, --suite,
4560
--include and --exclude.
4661

47-
Using Sauce Labs for acceptance tests
48-
-------------------------------------
49-
When running test by using browser from Sauce labs, it is required that the
50-
Sauce Connect is used. The Sauce Connect allows the browser from Sauce Labs
51-
reach the acceptance test web server. The acceptance test uses tunnel with
52-
name `localtunnel` and therefore when establishing the Sauce Connect tunnel
53-
use the following command::
54-
55-
bin/sc -u YOUR_USERNAME -k YOUR_ACCESS_KEY -i localtunnel
56-
57-
More details and to download Sauce Connect visit:
58-
https://wiki.saucelabs.com/display/DOCS/High+Availability+Sauce+Connect+Proxy+Setup
59-
6062
Examples
6163
--------
6264
Examples::
6365

6466
run.py chrome
6567
run.py --interpreter jython firefox --suite javascript
66-
run.py chrome --sauceusername your_username --saucekey account_key --suite javascript
68+
run.py headlesschrome --nounit --grid true
6769
run.py --interpreter "py -2" chrome --suite javascript
6870

6971
To run just the unit tests, run::
@@ -79,13 +81,12 @@ Travis CI integration
7981
`Travis CI`_ is used to automatically test all new pull request to the
8082
repository. The detailed information about execution matrix can be found
8183
from the `.travis.yam`_. Generally speaking the test are automatically run
82-
by using Chrome and Firefox browsers. The project uses Python 2.7, Python 3.4,
83-
Python 3.6 and PyPy 3.5 for test execution. The project uses and latest available
84-
Selenium 3 version for test execution. Test uses Robot Framework versions
85-
2.9.2 and 3.0.4 for acceptance test execution.
84+
by using Chrome browser and by using supported Python and Robot Framework
85+
versions. But in Travis only the latest released Selenium version is used.
8686

8787
.. _browser driver: https://github.com/robotframework/SeleniumLibrary#browser-drivers
8888
.. _PATH: https://en.wikipedia.org/wiki/PATH_(variable)
8989
.. _robotstatuschecker: https://github.com/robotframework/statuschecker/
9090
.. _Travis CI: https://travis-ci.org/robotframework/SeleniumLibrary
9191
.. _.travis.yam: https://github.com/robotframework/SeleniumLibrary/blob/master/.travis.yml
92+
.. _Selenium Grid: https://github.com/SeleniumHQ/selenium/wiki/Grid2

atest/acceptance/1-plugin/OpenBrowserExample.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@ def __init__(self, ctx):
1616
def open_browser(self, url, browser='firefox', alias=None,
1717
remote_url=False, desired_capabilities=None,
1818
ff_profile_dir=None, options=None, service_log_path=None,
19-
extra_dictionary=None):
19+
extra_dictionary=None, executable_path=None):
2020
self._new_creator.extra_dictionary = extra_dictionary
2121
browser_manager = BrowserManagementKeywords(self.ctx)
2222
browser_manager._make_driver = self._make_driver
2323
browser_manager.open_browser(url, browser=browser, alias=alias,
2424
remote_url=remote_url, desired_capabilities=desired_capabilities,
2525
ff_profile_dir=ff_profile_dir, options=options,
26-
service_log_path=service_log_path)
26+
service_log_path=service_log_path, executable_path=None)
2727

2828
def _make_driver(self, browser, desired_capabilities=None, profile_dir=None,
29-
remote=None, options=None, service_log_path=None):
29+
remote=None, options=None, service_log_path=None, executable_path=None):
3030
driver = self._new_creator.create_driver(
3131
browser=browser, desired_capabilities=desired_capabilities, remote_url=remote,
32-
profile_dir=profile_dir, options=options, service_log_path=service_log_path)
32+
profile_dir=profile_dir, options=options, service_log_path=service_log_path, executable_path=executable_path)
3333
driver.set_script_timeout(self.ctx.timeout)
3434
driver.implicitly_wait(self.ctx.implicit_wait)
3535
if self.ctx.speed:
@@ -40,7 +40,7 @@ def _make_driver(self, browser, desired_capabilities=None, profile_dir=None,
4040
class NewWebDriverCreator(WebDriverCreator):
4141

4242
def create_driver(self, browser, desired_capabilities, remote_url,
43-
profile_dir=None, options=None, service_log_path=None):
43+
profile_dir=None, options=None, service_log_path=None, executable_path=None):
4444
self.browser_names['seleniumwire'] = 'seleniumwire'
4545
browser = self._normalise_browser_name(browser)
4646
creation_method = self._get_creator_method(browser)

atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@ Event Firing Webdriver Input Text (WebElement)
3131
... LOG 1:14 INFO After clear and send_keys
3232
Input Text //input[@name="textfield"] FooBar
3333

34-
Event Firing Webdriver Click Element (WebElement)
34+
Event Firing Webdriver With Get WebElement (WebElement)
3535
[Tags] NoGrid
36-
[Documentation]
37-
... LOG 1:5 INFO Before click
38-
... LOG 1:9 INFO After click
39-
Click Element //input[@name="ok_button"]
36+
Go To ${ROOT}/nested_divs.html
37+
${link}= Get WebElement //a[@id="needleC"]
38+
Wait Until Element Contains ${link} top/c/needle

atest/acceptance/big_list_of_naught_strings.robot

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ Big List Of Naughty Strings
88
... https://github.com/minimaxir/big-list-of-naughty-strings
99
Open Browser To Start Page
1010
${blns} = blns.Get Blns
11-
:FOR ${string} IN @{blns}
12-
\ Check Blns Error Check ${string}
11+
FOR ${string} IN @{blns}
12+
Check Blns Error Check ${string}
13+
END
1314

1415
*** Keywords ***
1516
Check Blns Error Check

atest/acceptance/create_webdriver.robot

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ Create Webdriver With Duplicate Arguments
2828

2929
Create Webdriver With Bad Keyword Argument Dictionary
3030
[Documentation] Invalid arguments types
31-
Run Keyword And Expect Error kwargs must be a dictionary.
32-
... Create Webdriver Firefox kwargs={'spam': 'eggs'}
31+
${status} ${error} = Run Keyword And Ignore Error Create Webdriver Firefox kwargs={'spam': 'eggs'}
32+
Should Be Equal ${status} FAIL
33+
Should Match Regexp ${error} (TypeError: __init__\\(\\) got an unexpected keyword argument 'spam'|kwargs must be a dictionary\.)
3334

3435
*** Keywords ***
3536
Set Driver Variables
@@ -46,10 +47,9 @@ Set Driver Variables
4647
... htmlunitwithjs=HTMLUNITWITHJS android=ANDROID iphone=IPHONE
4748
... safari=SAFARI headlessfirefox=FIREFOX headlesschrome=CHROME
4849
${dc name}= Get From Dictionary ${dc names} ${BROWSER.lower().replace(' ', '')}
49-
${caps}= Evaluate sys.modules['selenium.webdriver'].DesiredCapabilities.${dc name}
50-
... selenium.webdriver,sys
51-
${url as str}= Evaluate str('${REMOTE_URL}') # cannot be unicode for versions >= 2.32
50+
${caps}= Evaluate selenium.webdriver.DesiredCapabilities.${dc name}
51+
... modules=selenium, selenium.webdriver
5252
${kwargs}= Create Dictionary
5353
Run Keyword If "${name}"=="Remote" Set To Dictionary ${kwargs} command_executor
54-
... ${url as str} desired_capabilities ${caps}
54+
... ${REMOTE_URL} desired_capabilities ${caps}
5555
Set Test Variable ${KWARGS} ${kwargs}

atest/acceptance/keywords/alerts.robot

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,16 @@ Alert Should Be Present with custom timeout
120120
... Alert Should Be Present timeout=1ms
121121
Alert Should Be Present Alert after 500ms! ACCEPT 3s
122122

123+
Handle Alert when popup window closes
124+
[Documentation] Popup window is closed by javascript while
125+
... 'Handle Alert' keyword is waiting for alert
126+
... FAIL GLOB: An exception occurred waiting for alert*
127+
[Setup] Go To Page "javascript/self_closing_popup.html"
128+
Click Button Self Closing
129+
${handle} = Switch Window NEW
130+
Handle Alert timeout=10s
131+
[Teardown] Switch Window ${handle}
132+
123133
*** Keywords ***
124134
Wait For Title Change
125135
[Arguments] ${expected}

0 commit comments

Comments
 (0)