selenium


Nameselenium JSON
Version 4.18.1 PyPI version JSON
download
home_pagehttps://www.selenium.dev
Summary
upload_time2024-02-20 00:14:24
maintainer
docs_urlNone
author
requires_python>=3.8
licenseApache 2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ======================
Selenium Client Driver
======================

Introduction
============

Python language bindings for Selenium WebDriver.

The `selenium` package is used to automate web browser interaction from Python.

+-----------------+--------------------------------------------------------------------------------------+
| **Home**:       | https://selenium.dev                                                                 |
+-----------------+--------------------------------------------------------------------------------------+
| **GitHub**:     | https://github.com/SeleniumHQ/Selenium                                               |
+-----------------+--------------------------------------------------------------------------------------+
| **PyPI**:       | https://pypi.org/project/selenium/                                                   |
+-----------------+--------------------------------------------------------------------------------------+
| **IRC/Slack**:  | `Selenium chat room <https://www.selenium.dev/support/#ChatRoom>`_                   |
+-----------------+--------------------------------------------------------------------------------------+

Several browsers/drivers are supported (Firefox, Chrome, Internet Explorer), as well as the Remote protocol.

Supported Python Versions
=========================

* Python 3.8+

Installing
==========

If you have `pip <https://pip.pypa.io/>`_ on your system, you can simply install or upgrade the Python bindings::

    pip install -U selenium

Alternately, you can download the source distribution from `PyPI <https://pypi.org/project/selenium/#files>`, unarchive it, and run::

    python setup.py install

Note: You may want to consider using `virtualenv <http://www.virtualenv.org/>`_ to create isolated Python environments.

Drivers
=======

Selenium requires a driver to interface with the chosen browser. Firefox,
for example, requires `geckodriver <https://github.com/mozilla/geckodriver/releases>`_, which needs to be installed before the below examples can be run. Make sure it's in your `PATH`, e. g., place it in `/usr/bin` or `/usr/local/bin`.

Failure to observe this step will give you an error `selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.`

Other supported browsers will have their own drivers available. Links to some of the more popular browser drivers follow.

+--------------+-----------------------------------------------------------------------+
| **Chrome**:  | https://chromedriver.chromium.org/downloads                           |
+--------------+-----------------------------------------------------------------------+
| **Edge**:    | https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ |
+--------------+-----------------------------------------------------------------------+
| **Firefox**: | https://github.com/mozilla/geckodriver/releases                       |
+--------------+-----------------------------------------------------------------------+
| **Safari**:  | https://webkit.org/blog/6900/webdriver-support-in-safari-10/          |
+--------------+-----------------------------------------------------------------------+

Example 0:
==========

* open a new Firefox browser
* load the page at the given URL

.. code-block:: python

    from selenium import webdriver

    browser = webdriver.Firefox()
    browser.get('http://selenium.dev/')

Example 1:
==========

* open a new Firefox browser
* load the Yahoo homepage
* search for "seleniumhq"
* close the browser

.. code-block:: python

    from selenium import webdriver
    from selenium.webdriver.common.by import By
    from selenium.webdriver.common.keys import Keys

    browser = webdriver.Firefox()

    browser.get('http://www.yahoo.com')
    assert 'Yahoo' in browser.title

    elem = browser.find_element(By.NAME, 'p')  # Find the search box
    elem.send_keys('seleniumhq' + Keys.RETURN)

    browser.quit()

Example 2:
==========

Selenium WebDriver is often used as a basis for testing web applications.  Here is a simple example using Python's standard `unittest <http://docs.python.org/3/library/unittest.html>`_ library:

.. code-block:: python

    import unittest
    from selenium import webdriver

    class GoogleTestCase(unittest.TestCase):

        def setUp(self):
            self.browser = webdriver.Firefox()
            self.addCleanup(self.browser.quit)

        def test_page_title(self):
            self.browser.get('http://www.google.com')
            self.assertIn('Google', self.browser.title)

    if __name__ == '__main__':
        unittest.main(verbosity=2)

Selenium Grid (optional)
==========================

For local Selenium scripts, the Java server is not needed.

To use Selenium remotely, you need to also run the Selenium grid.
For information on running Selenium Grid: https://www.selenium.dev/documentation/grid/getting_started/

To use Remote WebDriver see: https://www.selenium.dev/documentation/webdriver/drivers/remote_webdriver/?tab=python

Use The Source Luke!
====================

View source code online:

+-----------+------------------------------------------------------+
| Official: | https://github.com/SeleniumHQ/selenium/tree/trunk/py |
+-----------+------------------------------------------------------+

Contributing
=============

 - Create a branch for your work
 - Ensure `tox` is installed (using a `virtualenv` is recommended)
 - `python3.8 -m venv .venv && . .venv/bin/activate && pip install tox`
 - After making changes, before committing execute `tox -e linting`
 - If tox exits `0`, commit and push otherwise fix the newly introduced breakages.
 - `flake8` requires manual fixes
 - `black` will often rewrite the breakages automatically, however the files are unstaged and should staged again.
 - `isort` will often rewrite the breakages automatically, however the files are unstaged and should staged again.


            

Raw data

            {
    "_id": null,
    "home_page": "https://www.selenium.dev",
    "name": "selenium",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "",
    "author": "",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/5e/30/5d5d83efaac1c7b2aa45e383b74e733156dae6c67434c562f88e05db9ddb/selenium-4.18.1.tar.gz",
    "platform": null,
    "description": "======================\nSelenium Client Driver\n======================\n\nIntroduction\n============\n\nPython language bindings for Selenium WebDriver.\n\nThe `selenium` package is used to automate web browser interaction from Python.\n\n+-----------------+--------------------------------------------------------------------------------------+\n| **Home**:       | https://selenium.dev                                                                 |\n+-----------------+--------------------------------------------------------------------------------------+\n| **GitHub**:     | https://github.com/SeleniumHQ/Selenium                                               |\n+-----------------+--------------------------------------------------------------------------------------+\n| **PyPI**:       | https://pypi.org/project/selenium/                                                   |\n+-----------------+--------------------------------------------------------------------------------------+\n| **IRC/Slack**:  | `Selenium chat room <https://www.selenium.dev/support/#ChatRoom>`_                   |\n+-----------------+--------------------------------------------------------------------------------------+\n\nSeveral browsers/drivers are supported (Firefox, Chrome, Internet Explorer), as well as the Remote protocol.\n\nSupported Python Versions\n=========================\n\n* Python 3.8+\n\nInstalling\n==========\n\nIf you have `pip <https://pip.pypa.io/>`_ on your system, you can simply install or upgrade the Python bindings::\n\n    pip install -U selenium\n\nAlternately, you can download the source distribution from `PyPI <https://pypi.org/project/selenium/#files>`, unarchive it, and run::\n\n    python setup.py install\n\nNote: You may want to consider using `virtualenv <http://www.virtualenv.org/>`_ to create isolated Python environments.\n\nDrivers\n=======\n\nSelenium requires a driver to interface with the chosen browser. Firefox,\nfor example, requires `geckodriver <https://github.com/mozilla/geckodriver/releases>`_, which needs to be installed before the below examples can be run. Make sure it's in your `PATH`, e. g., place it in `/usr/bin` or `/usr/local/bin`.\n\nFailure to observe this step will give you an error `selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.`\n\nOther supported browsers will have their own drivers available. Links to some of the more popular browser drivers follow.\n\n+--------------+-----------------------------------------------------------------------+\n| **Chrome**:  | https://chromedriver.chromium.org/downloads                           |\n+--------------+-----------------------------------------------------------------------+\n| **Edge**:    | https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ |\n+--------------+-----------------------------------------------------------------------+\n| **Firefox**: | https://github.com/mozilla/geckodriver/releases                       |\n+--------------+-----------------------------------------------------------------------+\n| **Safari**:  | https://webkit.org/blog/6900/webdriver-support-in-safari-10/          |\n+--------------+-----------------------------------------------------------------------+\n\nExample 0:\n==========\n\n* open a new Firefox browser\n* load the page at the given URL\n\n.. code-block:: python\n\n    from selenium import webdriver\n\n    browser = webdriver.Firefox()\n    browser.get('http://selenium.dev/')\n\nExample 1:\n==========\n\n* open a new Firefox browser\n* load the Yahoo homepage\n* search for \"seleniumhq\"\n* close the browser\n\n.. code-block:: python\n\n    from selenium import webdriver\n    from selenium.webdriver.common.by import By\n    from selenium.webdriver.common.keys import Keys\n\n    browser = webdriver.Firefox()\n\n    browser.get('http://www.yahoo.com')\n    assert 'Yahoo' in browser.title\n\n    elem = browser.find_element(By.NAME, 'p')  # Find the search box\n    elem.send_keys('seleniumhq' + Keys.RETURN)\n\n    browser.quit()\n\nExample 2:\n==========\n\nSelenium WebDriver is often used as a basis for testing web applications.  Here is a simple example using Python's standard `unittest <http://docs.python.org/3/library/unittest.html>`_ library:\n\n.. code-block:: python\n\n    import unittest\n    from selenium import webdriver\n\n    class GoogleTestCase(unittest.TestCase):\n\n        def setUp(self):\n            self.browser = webdriver.Firefox()\n            self.addCleanup(self.browser.quit)\n\n        def test_page_title(self):\n            self.browser.get('http://www.google.com')\n            self.assertIn('Google', self.browser.title)\n\n    if __name__ == '__main__':\n        unittest.main(verbosity=2)\n\nSelenium Grid (optional)\n==========================\n\nFor local Selenium scripts, the Java server is not needed.\n\nTo use Selenium remotely, you need to also run the Selenium grid.\nFor information on running Selenium Grid: https://www.selenium.dev/documentation/grid/getting_started/\n\nTo use Remote WebDriver see: https://www.selenium.dev/documentation/webdriver/drivers/remote_webdriver/?tab=python\n\nUse The Source Luke!\n====================\n\nView source code online:\n\n+-----------+------------------------------------------------------+\n| Official: | https://github.com/SeleniumHQ/selenium/tree/trunk/py |\n+-----------+------------------------------------------------------+\n\nContributing\n=============\n\n - Create a branch for your work\n - Ensure `tox` is installed (using a `virtualenv` is recommended)\n - `python3.8 -m venv .venv && . .venv/bin/activate && pip install tox`\n - After making changes, before committing execute `tox -e linting`\n - If tox exits `0`, commit and push otherwise fix the newly introduced breakages.\n - `flake8` requires manual fixes\n - `black` will often rewrite the breakages automatically, however the files are unstaged and should staged again.\n - `isort` will often rewrite the breakages automatically, however the files are unstaged and should staged again.\n\n",
    "bugtrack_url": null,
    "license": "Apache 2.0",
    "summary": "",
    "version": "4.18.1",
    "project_urls": {
        "Homepage": "https://www.selenium.dev"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3ffdc2e7bb547b5b96c7bd536b4a80c4564b7ce5cd38d10095fbba8648996ab9",
                "md5": "61f1566864bba415855b6860c03165c2",
                "sha256": "b24a3cdd2d47c29832e81345bfcde0c12bb608738013e53c781b211b418df241"
            },
            "downloads": -1,
            "filename": "selenium-4.18.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "61f1566864bba415855b6860c03165c2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 10005848,
            "upload_time": "2024-02-20T00:14:19",
            "upload_time_iso_8601": "2024-02-20T00:14:19.999870Z",
            "url": "https://files.pythonhosted.org/packages/3f/fd/c2e7bb547b5b96c7bd536b4a80c4564b7ce5cd38d10095fbba8648996ab9/selenium-4.18.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5e305d5d83efaac1c7b2aa45e383b74e733156dae6c67434c562f88e05db9ddb",
                "md5": "9be33a0a80dca6ef71d6343052ac6fc4",
                "sha256": "a11f67afa8bfac6b77e148c987b33f6b14eb1cae4d352722a75de1f26e3f0ae2"
            },
            "downloads": -1,
            "filename": "selenium-4.18.1.tar.gz",
            "has_sig": false,
            "md5_digest": "9be33a0a80dca6ef71d6343052ac6fc4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 9790321,
            "upload_time": "2024-02-20T00:14:24",
            "upload_time_iso_8601": "2024-02-20T00:14:24.821437Z",
            "url": "https://files.pythonhosted.org/packages/5e/30/5d5d83efaac1c7b2aa45e383b74e733156dae6c67434c562f88e05db9ddb/selenium-4.18.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-20 00:14:24",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "selenium"
}
        
Elapsed time: 0.29778s