selenium


Nameselenium JSON
Version 4.26.1 PyPI version JSON
download
home_pagehttps://www.selenium.dev
SummaryOfficial Python bindings for Selenium WebDriver
upload_time2024-10-31 18:40:17
maintainerNone
docs_urlNone
authorNone
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": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/3f/b1/e9efcb88d5682e802cf03bdee4886f854d75bdb2859d1e72cb74041b4ef6/selenium-4.26.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": "Official Python bindings for Selenium WebDriver",
    "version": "4.26.1",
    "project_urls": {
        "Homepage": "https://www.selenium.dev"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "910810cff8463b3510b78f9e3dcef6b37c542b06d71ed1240a8940ba0c75d3bc",
                "md5": "3f0a85181144925c8527da2e041c2ec7",
                "sha256": "1db3f3a0cd5bb07624fa8a3905a6fdde1595a42185a0617077c361dc53d104fb"
            },
            "downloads": -1,
            "filename": "selenium-4.26.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3f0a85181144925c8527da2e041c2ec7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 9696270,
            "upload_time": "2024-10-31T18:40:13",
            "upload_time_iso_8601": "2024-10-31T18:40:13.469081Z",
            "url": "https://files.pythonhosted.org/packages/91/08/10cff8463b3510b78f9e3dcef6b37c542b06d71ed1240a8940ba0c75d3bc/selenium-4.26.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3fb1e9efcb88d5682e802cf03bdee4886f854d75bdb2859d1e72cb74041b4ef6",
                "md5": "fe1d8f975ec63c309e379d3ca98d72be",
                "sha256": "7640f3f08ae7f4e450f895678e8a10a55eb4e4ca18311ed675ecc4684b96b683"
            },
            "downloads": -1,
            "filename": "selenium-4.26.1.tar.gz",
            "has_sig": false,
            "md5_digest": "fe1d8f975ec63c309e379d3ca98d72be",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 967543,
            "upload_time": "2024-10-31T18:40:17",
            "upload_time_iso_8601": "2024-10-31T18:40:17.320244Z",
            "url": "https://files.pythonhosted.org/packages/3f/b1/e9efcb88d5682e802cf03bdee4886f854d75bdb2859d1e72cb74041b4ef6/selenium-4.26.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-31 18:40:17",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "selenium"
}
        
Elapsed time: 1.04987s