SeleniumLibrary
===============
.. contents::
Introduction
------------
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.12.
In addition to the normal Python_ interpreter, it works also
with PyPy_.
SeleniumLibrary is based on the "old SeleniumLibrary" that was forked to
Selenium2Library and then later renamed back to SeleniumLibrary.
See the `VERSIONS.rst`_ for more information about different versions and the
overall project history.
.. image:: https://img.shields.io/pypi/v/robotframework-seleniumlibrary.svg?label=version
:target: https://pypi.python.org/pypi/robotframework-seleniumlibrary
.. image:: https://img.shields.io/pypi/dm/robotframework-seleniumlibrary.svg
:target: https://pypi.python.org/pypi/robotframework-seleniumlibrary
.. 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/actions/workflows/CI.yml/badge.svg?branch=master
:target: https://github.com/robotframework/SeleniumLibrary/actions/workflows/CI.yml
Keyword Documentation
---------------------
See `keyword documentation`_ for available keywords and more information
about the library in general.
Installation
------------
The recommended installation method is using pip_::
pip install --upgrade robotframework-seleniumlibrary
Running this command installs also the latest Selenium and Robot Framework
versions, but you still need to install `browser drivers`_ separately.
The ``--upgrade`` option can be omitted when installing the library for the
first time.
It is possible to install directly from the GitHub_ repository. To install
latest source from the master branch, use this command::
pip install git+https://github.com/robotframework/SeleniumLibrary.git
Please note that installation will take some time, because ``pip`` will
clone the SeleniumLibrary_ project to a temporary directory and then
perform the installation.
See `Robot Framework installation instructions`_ for detailed information
about installing Python and Robot Framework itself. For more details about
using ``pip`` see `its own documentation <pip_>`__.
Browser drivers
---------------
After installing the library, you still need to install browser and
operating system specific browser drivers for all those browsers you
want to use in tests. These are the exact same drivers you need to use with
Selenium also when not using SeleniumLibrary. More information about
drivers can be found from `Selenium documentation`__.
The general approach to install a browser driver is downloading a right
driver, such as ``chromedriver`` for Chrome, and placing it into
a directory that is in PATH__. Drivers for different browsers
can be found via Selenium documentation or by using your favorite
search engine with a search term like ``selenium chrome browser driver``.
New browser driver versions are released to support features in
new browsers, fix bug, or otherwise, and you need to keep an eye on them
to know when to update drivers you use.
Alternatively, you can use a tool called WebdriverManager__ which can
find the latest version or when required, any version of appropriate
webdrivers for you and then download and link/copy it into right
location. Tool can run on all major operating systems and supports
downloading of Chrome, Firefox, Opera & Edge webdrivers.
Here's an example:
.. code:: bash
pip install webdrivermanager
webdrivermanager firefox chrome --linkpath /usr/local/bin
__ https://seleniumhq.github.io/selenium/docs/api/py/index.html#drivers
__ https://en.wikipedia.org/wiki/PATH_(variable)
__ https://github.com/omenia/webdrivermanager
Usage
-----
To use SeleniumLibrary in Robot Framework tests, the library needs to
first be imported using the ``Library`` setting as any other library.
The library accepts some import time arguments, which are documented
in the `keyword documentation`_ along with all the keywords provided
by the library.
When using Robot Framework, it is generally recommended to write as
easy-to-understand tests as possible. The keywords provided by
SeleniumLibrary is pretty low level, though, and often require
implementation-specific arguments like element locators to be passed
as arguments. It is thus typically a good idea to write tests using
Robot Framework's higher-level keywords that utilize SeleniumLibrary
keywords internally. This is illustrated by the following example
where SeleniumLibrary keywords like ``Input Text`` are primarily
used by higher-level keywords like ``Input Username``.
.. code:: robotframework
*** Settings ***
Documentation Simple example using SeleniumLibrary.
Library SeleniumLibrary
*** Variables ***
${LOGIN URL} http://localhost:7272
${BROWSER} Chrome
*** Test Cases ***
Valid Login
Open Browser To Login Page
Input Username demo
Input Password mode
Submit Credentials
Welcome Page Should Be Open
[Teardown] Close Browser
*** Keywords ***
Open Browser To Login Page
Open Browser ${LOGIN URL} ${BROWSER}
Title Should Be Login Page
Input Username
[Arguments] ${username}
Input Text username_field ${username}
Input Password
[Arguments] ${password}
Input Text password_field ${password}
Submit Credentials
Click Button login_button
Welcome Page Should Be Open
Title Should Be Welcome Page
The above example is a slightly modified version of an example in a
`demo project`_ that illustrates using Robot Framework and SeleniumLibrary.
See the demo for more examples that you can also execute on your own
machine. For more information about Robot Framework test data syntax in
general see the `Robot Framework User Guide`_.
Extending SeleniumLibrary
-------------------------
Before creating your own library which extends the ``SeleniumLibrary``, please consider would
the extension be also useful also for general usage. If it could be useful also for general
usage, please create a new issue describing the enhancement request and even better if the
issue is backed up by a pull request.
If the enhancement is not generally useful, example solution is domain specific, then the
SeleniumLibrary offers public APIs which can be used to build its own plugins and libraries.
Plugin API allows us to add new keywords, modify existing keywords and modify the internal
functionality of the library. Also new libraries can be built on top of the
SeleniumLibrary. Please see `extending documentation`_ for more details about the
available methods and for examples how the library can be extended.
Community
---------
If the provided documentation is not enough, there are various community channels
available:
- ``#seleniumlibrary`` and ``#seleniumlibrary-dev`` channels in
Robot Framework `Slack community`_
- `Robot Framework forum`_ has channel for SeleniumLibrary.
- SeleniumLibrary `issue tracker`_ for bug reports and concrete enhancement
requests
- `Other community channels`_ including paid support
.. _Robot Framework: https://robotframework.org
.. _Selenium: https://www.seleniumhq.org/
.. _SeleniumLibrary: https://github.com/robotframework/SeleniumLibrary
.. _pip: http://pip-installer.org
.. _PyPI: https://pypi.python.org/pypi/robotframework-seleniumlibrary
.. _GitHub: https://github.com/robotframework/SeleniumLibrary
.. _Keyword Documentation: https://robotframework.org/SeleniumLibrary/SeleniumLibrary.html
.. _Python: https://python.org
.. _PyPy: https://pypy.org
.. _demo project: https://github.com/robotframework/WebDemo
.. _Robot Framework User Guide: https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html
.. _Robot Framework installation instructions: https://github.com/robotframework/robotframework/blob/master/INSTALL.rst
.. _extending documentation: https://github.com/robotframework/SeleniumLibrary/blob/master/docs/extending/extending.rst
.. _Slack community: https://robotframework-slack-invite.herokuapp.com
.. _Robot Framework forum: https://forum.robotframework.org/
.. _issue tracker: https://github.com/robotframework/SeleniumLibrary/issues
.. _Other community channels: https://robotframework.org/#community
.. _VERSIONS.rst: https://github.com/robotframework/SeleniumLibrary/blob/master/VERSIONS.rst
Raw data
{
"_id": null,
"home_page": "https://github.com/robotframework/SeleniumLibrary",
"name": "robotframework-seleniumlibrary",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.13,>=3.8",
"maintainer_email": null,
"keywords": "robotframework testing testautomation selenium webdriver web",
"author": "Ed Manlove, Yuri Verweij, Lisa Crispin",
"author_email": "emanlove@verizon.net",
"download_url": "https://files.pythonhosted.org/packages/98/4e/70d7b368c11180ad025c1f542a20f6bd80ed7c7a7bb14a02380998eecb29/robotframework_seleniumlibrary-6.6.1.tar.gz",
"platform": "any",
"description": "SeleniumLibrary\n===============\n\n.. contents::\n\nIntroduction\n------------\n\nSeleniumLibrary_ is a web testing library for `Robot Framework`_ that\nutilizes the Selenium_ tool internally. The project is hosted on GitHub_\nand downloads can be found from PyPI_.\n\nSeleniumLibrary currently works with Selenium 4. It supports Python 3.8 through 3.12.\nIn addition to the normal Python_ interpreter, it works also\nwith PyPy_.\n\nSeleniumLibrary is based on the \"old SeleniumLibrary\" that was forked to\nSelenium2Library and then later renamed back to SeleniumLibrary.\nSee the `VERSIONS.rst`_ for more information about different versions and the\noverall project history.\n\n.. image:: https://img.shields.io/pypi/v/robotframework-seleniumlibrary.svg?label=version\n :target: https://pypi.python.org/pypi/robotframework-seleniumlibrary\n \n.. image:: https://img.shields.io/pypi/dm/robotframework-seleniumlibrary.svg\n :target: https://pypi.python.org/pypi/robotframework-seleniumlibrary\n\n.. image:: https://img.shields.io/pypi/l/robotframework-seleniumlibrary.svg\n :target: https://www.apache.org/licenses/LICENSE-2.0\n\n.. image:: https://github.com/robotframework/SeleniumLibrary/actions/workflows/CI.yml/badge.svg?branch=master\n :target: https://github.com/robotframework/SeleniumLibrary/actions/workflows/CI.yml\n\nKeyword Documentation\n---------------------\nSee `keyword documentation`_ for available keywords and more information\nabout the library in general.\n\nInstallation\n------------\n\nThe recommended installation method is using pip_::\n\n pip install --upgrade robotframework-seleniumlibrary\n\nRunning this command installs also the latest Selenium and Robot Framework\nversions, but you still need to install `browser drivers`_ separately.\nThe ``--upgrade`` option can be omitted when installing the library for the\nfirst time.\n\nIt is possible to install directly from the GitHub_ repository. To install\nlatest source from the master branch, use this command::\n\n pip install git+https://github.com/robotframework/SeleniumLibrary.git\n\nPlease note that installation will take some time, because ``pip`` will\nclone the SeleniumLibrary_ project to a temporary directory and then\nperform the installation.\n\nSee `Robot Framework installation instructions`_ for detailed information\nabout installing Python and Robot Framework itself. For more details about\nusing ``pip`` see `its own documentation <pip_>`__.\n\nBrowser drivers\n---------------\n\nAfter installing the library, you still need to install browser and\noperating system specific browser drivers for all those browsers you\nwant to use in tests. These are the exact same drivers you need to use with\nSelenium also when not using SeleniumLibrary. More information about\ndrivers can be found from `Selenium documentation`__.\n\nThe general approach to install a browser driver is downloading a right\ndriver, such as ``chromedriver`` for Chrome, and placing it into\na directory that is in PATH__. Drivers for different browsers\ncan be found via Selenium documentation or by using your favorite\nsearch engine with a search term like ``selenium chrome browser driver``.\nNew browser driver versions are released to support features in\nnew browsers, fix bug, or otherwise, and you need to keep an eye on them\nto know when to update drivers you use.\n\nAlternatively, you can use a tool called WebdriverManager__ which can\nfind the latest version or when required, any version of appropriate\nwebdrivers for you and then download and link/copy it into right\nlocation. Tool can run on all major operating systems and supports\ndownloading of Chrome, Firefox, Opera & Edge webdrivers.\n\nHere's an example:\n\n.. code:: bash\n\n pip install webdrivermanager\n webdrivermanager firefox chrome --linkpath /usr/local/bin\n\n\n\n__ https://seleniumhq.github.io/selenium/docs/api/py/index.html#drivers\n__ https://en.wikipedia.org/wiki/PATH_(variable)\n__ https://github.com/omenia/webdrivermanager\n\nUsage\n-----\n\nTo use SeleniumLibrary in Robot Framework tests, the library needs to\nfirst be imported using the ``Library`` setting as any other library.\nThe library accepts some import time arguments, which are documented\nin the `keyword documentation`_ along with all the keywords provided\nby the library.\n\nWhen using Robot Framework, it is generally recommended to write as\neasy-to-understand tests as possible. The keywords provided by\nSeleniumLibrary is pretty low level, though, and often require\nimplementation-specific arguments like element locators to be passed\nas arguments. It is thus typically a good idea to write tests using\nRobot Framework's higher-level keywords that utilize SeleniumLibrary\nkeywords internally. This is illustrated by the following example\nwhere SeleniumLibrary keywords like ``Input Text`` are primarily\nused by higher-level keywords like ``Input Username``.\n\n.. code:: robotframework\n\n *** Settings ***\n Documentation Simple example using SeleniumLibrary.\n Library SeleniumLibrary\n\n *** Variables ***\n ${LOGIN URL} http://localhost:7272\n ${BROWSER} Chrome\n\n *** Test Cases ***\n Valid Login\n Open Browser To Login Page\n Input Username demo\n Input Password mode\n Submit Credentials\n Welcome Page Should Be Open\n [Teardown] Close Browser\n\n *** Keywords ***\n Open Browser To Login Page\n Open Browser ${LOGIN URL} ${BROWSER}\n Title Should Be Login Page\n\n Input Username\n [Arguments] ${username}\n Input Text username_field ${username}\n\n Input Password\n [Arguments] ${password}\n Input Text password_field ${password}\n\n Submit Credentials\n Click Button login_button\n\n Welcome Page Should Be Open\n Title Should Be Welcome Page\n\n\nThe above example is a slightly modified version of an example in a\n`demo project`_ that illustrates using Robot Framework and SeleniumLibrary.\nSee the demo for more examples that you can also execute on your own\nmachine. For more information about Robot Framework test data syntax in\ngeneral see the `Robot Framework User Guide`_.\n\nExtending SeleniumLibrary\n-------------------------\nBefore creating your own library which extends the ``SeleniumLibrary``, please consider would\nthe extension be also useful also for general usage. If it could be useful also for general\nusage, please create a new issue describing the enhancement request and even better if the\nissue is backed up by a pull request.\n\nIf the enhancement is not generally useful, example solution is domain specific, then the\nSeleniumLibrary offers public APIs which can be used to build its own plugins and libraries.\nPlugin API allows us to add new keywords, modify existing keywords and modify the internal\nfunctionality of the library. Also new libraries can be built on top of the\nSeleniumLibrary. Please see `extending documentation`_ for more details about the\navailable methods and for examples how the library can be extended.\n\nCommunity\n---------\n\nIf the provided documentation is not enough, there are various community channels\navailable:\n\n- ``#seleniumlibrary`` and ``#seleniumlibrary-dev`` channels in\n Robot Framework `Slack community`_\n- `Robot Framework forum`_ has channel for SeleniumLibrary.\n- SeleniumLibrary `issue tracker`_ for bug reports and concrete enhancement\n requests\n- `Other community channels`_ including paid support\n\n\n.. _Robot Framework: https://robotframework.org\n.. _Selenium: https://www.seleniumhq.org/\n.. _SeleniumLibrary: https://github.com/robotframework/SeleniumLibrary\n.. _pip: http://pip-installer.org\n.. _PyPI: https://pypi.python.org/pypi/robotframework-seleniumlibrary\n.. _GitHub: https://github.com/robotframework/SeleniumLibrary\n.. _Keyword Documentation: https://robotframework.org/SeleniumLibrary/SeleniumLibrary.html\n.. _Python: https://python.org\n.. _PyPy: https://pypy.org\n.. _demo project: https://github.com/robotframework/WebDemo\n.. _Robot Framework User Guide: https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html\n.. _Robot Framework installation instructions: https://github.com/robotframework/robotframework/blob/master/INSTALL.rst\n.. _extending documentation: https://github.com/robotframework/SeleniumLibrary/blob/master/docs/extending/extending.rst\n.. _Slack community: https://robotframework-slack-invite.herokuapp.com\n.. _Robot Framework forum: https://forum.robotframework.org/\n.. _issue tracker: https://github.com/robotframework/SeleniumLibrary/issues\n.. _Other community channels: https://robotframework.org/#community\n.. _VERSIONS.rst: https://github.com/robotframework/SeleniumLibrary/blob/master/VERSIONS.rst\n\n",
"bugtrack_url": null,
"license": "Apache License 2.0",
"summary": "Web testing library for Robot Framework",
"version": "6.6.1",
"project_urls": {
"Homepage": "https://github.com/robotframework/SeleniumLibrary"
},
"split_keywords": [
"robotframework",
"testing",
"testautomation",
"selenium",
"webdriver",
"web"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a379177610a193f6d6f6cb515fcce4035a07f41af178852c15bbf3ba633fe07f",
"md5": "b14abba0c51b4489ae2f42d8e3d2ca99",
"sha256": "75f9f9d39a499c515a886a8c59ec1a63dad492d289783d9fc272dad4110120c7"
},
"downloads": -1,
"filename": "robotframework_seleniumlibrary-6.6.1-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "b14abba0c51b4489ae2f42d8e3d2ca99",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": "<3.13,>=3.8",
"size": 104510,
"upload_time": "2024-09-06T20:27:34",
"upload_time_iso_8601": "2024-09-06T20:27:34.897962Z",
"url": "https://files.pythonhosted.org/packages/a3/79/177610a193f6d6f6cb515fcce4035a07f41af178852c15bbf3ba633fe07f/robotframework_seleniumlibrary-6.6.1-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "984e70d7b368c11180ad025c1f542a20f6bd80ed7c7a7bb14a02380998eecb29",
"md5": "de207c02613a3b4dde476580c043a5ad",
"sha256": "6fd3a20c0ca70425d2c4b89e372d2c2399aa059a815c8cab87a2616bcfece7b4"
},
"downloads": -1,
"filename": "robotframework_seleniumlibrary-6.6.1.tar.gz",
"has_sig": false,
"md5_digest": "de207c02613a3b4dde476580c043a5ad",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.13,>=3.8",
"size": 170907,
"upload_time": "2024-09-06T20:27:36",
"upload_time_iso_8601": "2024-09-06T20:27:36.534217Z",
"url": "https://files.pythonhosted.org/packages/98/4e/70d7b368c11180ad025c1f542a20f6bd80ed7c7a7bb14a02380998eecb29/robotframework_seleniumlibrary-6.6.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-06 20:27:36",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "robotframework",
"github_project": "SeleniumLibrary",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "robotframework-seleniumlibrary"
}