pytest-splinter


Namepytest-splinter JSON
Version 3.3.2 PyPI version JSON
download
home_pagehttps://github.com/pytest-dev/pytest-splinter
SummarySplinter plugin for pytest testing framework
upload_time2022-09-09 19:46:54
maintainer
docs_urlNone
authorAnatoly Bubenkov, Paylogic International and others
requires_python
licenseMIT license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            Splinter plugin for the pytest runner
======================================

.. image:: https://badges.gitter.im/pytest-dev/pytest-splinter.svg
   :alt: Join the chat at https://gitter.im/pytest-dev/pytest-splinter
   :target: https://gitter.im/pytest-dev/pytest-splinter?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge

.. image:: https://img.shields.io/pypi/v/pytest-splinter.svg
   :target: https://pypi.python.org/pypi/pytest-splinter
.. image:: https://img.shields.io/pypi/pyversions/pytest-splinter.svg
  :target: https://pypi.python.org/pypi/pytest-splinter
.. image:: https://img.shields.io/coveralls/pytest-dev/pytest-splinter/master.svg
   :target: https://coveralls.io/r/pytest-dev/pytest-splinter
.. image:: https://github.com/pytest-dev/pytest-splinter/actions/workflows/tests.yml/badge.svg
        :target: https://github.com/pytest-dev/pytest-splinter/actions
.. image:: https://readthedocs.org/projects/pytest-splinter/badge/?version=latest
    :target: https://readthedocs.org/projects/pytest-splinter/?badge=latest
    :alt: Documentation Status


Install pytest-splinter
-----------------------

::

    pip install pytest-splinter


Features
--------

The plugin provides a set of fixtures to use `splinter <https://splinter.readthedocs.io>`_
for browser testing with `pytest <http://pytest.org>`_


Fixtures
--------

* browser
    Get the splinter's Browser. Fixture is underneath session scoped, so browser process is started
    once per test session, but the state of the browser will be clean (current page is ``blank``, cookies clean).

* session_browser
    The same as ``browser`` except the lifetime. This fixture is session-scoped so will only be finalized at the
    end of the whole test session. Useful if you want to speedup your test suite paying with reduced test isolation.

* browser_instance_getter
    Function to create an instance of the browser. This fixture is required only if you need to have
    multiple instances of the Browser in a single test at the same time. Example of usage:

.. code-block:: python

    @pytest.fixture
    def admin_browser(request, browser_instance_getter):
        """Admin browser fixture."""
        # browser_instance_getter function receives parent fixture -- our admin_browser
        return browser_instance_getter(request, admin_browser)

    def test_2_browsers(browser, admin_browser):
        """Test using 2 browsers at the same time."""
        browser.visit('http://google.com')
        admin_browser.visit('http://admin.example.com')

* splinter_selenium_implicit_wait
    Implicit wait timeout to be passed to Selenium webdriver.
    Fixture gets the value from the command-line option splinter-implicit-wait (see below)

* splinter_wait_time
    Explicit wait timeout (for waiting for explicit condition via `wait_for_condition`).
    Fixture gets the value from the command-line option splinter-wait-time (see below)

* splinter_selenium_speed
    Speed for Selenium, if not 0 then it will sleep between each selenium command.
    Useful for debugging/demonstration.
    Fixture gets the value from the command-line option splinter-speed (see below)

* splinter_selenium_socket_timeout
    Socket timeout for communication between the webdriver and the browser.
    Fixture gets the value from the command-line option splinter-socket-timeout (see below)

* splinter_webdriver
    Splinter's webdriver name to use. Fixture gets the value from the command-line option
    splinter-webdriver (see below). To make pytest-splinter always use certain webdriver, override a fixture
    in your `conftest.py` file:

.. code-block:: python

    import pytest

    @pytest.fixture(scope='session')
    def splinter_webdriver():
        """Override splinter webdriver name."""
        return 'chrome'

* splinter_remote_url
    Splinter's webdriver remote url to use (optional). Fixture gets the value from the command-line option
    splinter-remote-url (see below). Will be used only if selected webdriver name is 'remote'.

* splinter_session_scoped_browser
    pytest-splinter should use single browser instance per test session.
    Fixture gets the value from the command-line option splinter-session-scoped-browser (see below)

* splinter_file_download_dir
    Directory, to which browser will automatically download the files it
    will experience during browsing. For example when you click on some download link.
    By default it's a temporary directory. Automatic downloading of files is only supported for firefox driver
    at the moment.

* splinter_download_file_types
    Comma-separated list of content types to automatically download.
    By default it's the all known system mime types (via mimetypes standard library).

* splinter_browser_load_condition
    Browser load condition, python function which should return True.
    If function returns False, it will be run several times, until timeout below reached.

* splinter_browser_load_timeout
    Browser load condition timeout in seconds, after this timeout the exception
    WaitUntilTimeout will be raised.

* splinter_wait_time
    Browser explicit wait timeout in seconds, after this timeout the exception
    WaitUntilTimeout will be raised.

* splinter_firefox_profile_preferences
    Firefox profile preferences, a dictionary which is passed to selenium
    webdriver's profile_preferences

* splinter_firefox_profile_directory
    Firefox profile directory to use as template for firefox profile created by selenium.
    By default, it's an empty directly inside pytest_splinter/profiles/firefox

* splinter_driver_kwargs
    Webdriver keyword arguments, a dictionary which is passed to selenium
    webdriver's constructor (after applying firefox preferences)
    
.. code-block:: python

    import pytest
    from pathlib import Path
    
    @pytest.fixture
    def splinter_driver_kwargs():
        """
        Webdriver kwargs for Firefox.
        https://selenium-python.readthedocs.io/api.html#module-selenium.webdriver.firefox.webdriver
        """
        return {"service_log_path": Path("/log/directory/geckodriver.log")}

The snippet below configures Chrome to ignore certificate errors and sets a specific window size

.. code-block:: python

    import pytest
    from selenium import webdriver

    @pytest.fixture(scope='session')
    def splinter_driver_kwargs():
        """Override Chrome WebDriver options"""
        chrome_options = webdriver.ChromeOptions()

        # List of Chromium Command Line Switches
        # https://peter.sh/experiments/chromium-command-line-switches/
        chrome_options.add_argument("--window-size=1440,1200")
        chrome_options.add_argument("--ignore-ssl-errors=yes")
        chrome_options.add_argument("--ignore-certificate-errors")

        return {"options": chrome_options}

* splinter_window_size
    Size of the browser window on browser initialization. Tuple in form (<width>, <height>). Default is (1366, 768)

* splinter_screenshot_dir
    pytest-splinter browser screenshot directory.
    This fixture gets the value from the command-line option
    `splinter-screenshot-dir` (see below).

* splinter_make_screenshot_on_failure
    Should pytest-splinter take browser screenshots on test failure?
    This fixture gets the value from the command-line option
    `splinter-make-screenshot-on-failure` (see below).

* splinter_screenshot_encoding
    Encoding of the `html` `screenshot` on test failure. UTF-8 by default.

* splinter_screenshot_getter_html
    Function to get browser html screenshot. By default, it saves `browser.html` with given path and
    `splinter_screenshot_encoding` encoding.

* splinter_screenshot_getter_png
    Function to get browser image (png) screenshot. By default, it calls `browser.save_sceenshot`
    with given path.

* splinter_driver_executable
    Filesystem path of the webdriver executable.
    This fixture gets the value from the command-line option
    `splinter-webdriver-executable` (see below).

* splinter_browser_class
    Class to use for browser instance.
    Defaults to `pytest_splinter.plugin.Browser`.

* splinter_clean_cookies_urls
    List of additional urls to clean cookies on. By default, during the preparation of the browser for the test,
    pytest-splinter only cleans cookies for the last visited url from previous test, as it's not possible to clean
    all cookies from all domains at once via webdriver protocol, by design. This limitation can be worked around if
    you know the list of urls, the domains for which you need to clean cookies (for example https://facebook.com).
    If so, you can override this fixture and put those urls there, and pytest-splinter will visit each of them and will
    clean the cookies for each domain.

* splinter_headless
    Run Chrome in headless mode. Defaults to false. http://splinter.readthedocs.io/en/latest/drivers/chrome.html#using-headless-option-for-chrome

Command-line options
--------------------

* `--splinter-implicit-wait`
    Selenium webdriver implicit wait. Seconds (default: 5).

* `--splinter-speed`
    selenium webdriver speed (from command to command). Seconds (default: 0).

* `--splinter-socket-timeout`
    Selenium webdriver socket timeout for for communication between the webdriver and the browser.
    Seconds (default: 120).

* `--splinter-webdriver`
    Webdriver name to use. (default: firefox). Options:

    *  firefox
    *  remote
    *  chrome

    For more details refer to the documentation for splinter and selenium.

* `--splinter-remote-url`
    Webdriver remote url to use. (default: None). Will be used only if selected webdriver name is 'remote'.

    For more details refer to the documentation for splinter and selenium.

* `--splinter-session-scoped-browser`
    pytest-splinter should use a single browser instance per test session.
    Choices are 'true' or 'false' (default: 'true').

* `--splinter-make-screenshot-on-failure`
    pytest-splinter should take browser screenshots on test failure.
    Choices are 'true' or 'false' (default: 'true').

* `--splinter-screenshot-dir`
    pytest-splinter browser screenshot directory. Defaults to the current
    directory.

* `--splinter-webdriver-executable`
    Filesystem path of the webdriver executable. Used by chrome driver.
    Defaults to the None in which case the shell PATH variable setting determines the location of the executable.

* `--splinter-headless`
    Override `splinter_headless` fixture. Choices are 'true' or 'false', default: 'true'.
    http://splinter.readthedocs.io/en/latest/drivers/chrome.html#using-headless-option-for-chrome
    https://splinter.readthedocs.io/en/latest/drivers/firefox.html#using-headless-option-for-firefox

Browser fixture
---------------

As mentioned above, browser is a fixture made by creating splinter's Browser object, but with some overrides.

*  visit
    Added possibility to wait for condition on each browser visit by having a fixture.

*  wait_for_condition
    Method copying selenium's wait_for_condition, with difference that condition is in python,
    so there you can do whatever you want, and not only execute javascript via browser.evaluate_script.


Automatic screenshots on test failure
-------------------------------------

When your functional test fails, it's important to know the reason.
This becomes hard when tests are being run on the continuous integration server,
where you cannot debug (using --pdb).
To simplify things, a special behaviour of the browser fixture is available,
which takes a screenshot on test failure and puts it in a folder with the a
naming convention compatible to the
`jenkins plugin <https://wiki.jenkins-ci.org/display/JENKINS/JUnit+Attachments+Plugin>`_.
The html content of the browser page is also stored, this can be useful for debugging the html source.

Creating screenshots is fully compatible with `pytest-xdist plugin
<https://pypi.python.org/pypi/pytest-xdist>`_ and will transfer the screenshots
from the worker nodes through the communication channel automatically.

If a test (using the browser fixture) fails, you should get a screenshot files
in the following path:

::

    <splinter-screenshot-dir>/my.dotted.name.test.package/test_name-browser.png
    <splinter-screenshot-dir>/my.dotted.name.test.package/test_name-browser.html

The `splinter-screenshot-dir` for storing the screenshot is generated by a
fixture and can be provided through a command line argument, as described above
at the configuration options section.

Taking screenshots on test failure is enabled by default. It can be controlled
through the `splinter_make_screenshot_on_failure` fixture, where return `False`
skips it. You can also disable it via a command line argument:

::

    pytest tests/functional --splinter-make-screenshot-on-failure=false

In case taking a screenshot fails, a pytest warning will be issued, which
can be viewed using the `-rw` argument for `pytest`.


Python3 support
---------------

Python3 is supported, check if you have recent version of splinter as it was added recently.


Example
-------

test_your_test.py:

.. code-block:: python

    def test_some_browser_stuff(browser):
        """Test using real browser."""
        url = "http://www.google.com"
        browser.visit(url)
        browser.fill('q', 'splinter - python acceptance testing for web applications')
        # Find and click the 'search' button
        button = browser.find_by_name('btnK')
        # Interact with elements
        button.click()
        assert browser.is_text_present('splinter.cobrateam.info'), "splinter.cobrateam.info wasn't found... We need to"
        ' improve our SEO techniques'


Contact
-------

If you have questions, bug reports, suggestions, etc. please create an issue on
the `GitHub project page <http://github.com/paylogic/pytest-splinter>`_.


License
-------

This software is licensed under the `MIT license <http://en.wikipedia.org/wiki/MIT_License>`_

See `License file <https://github.com/paylogic/pytest-splinter/blob/master/LICENSE.txt>`_


© 2014 Anatoly Bubenkov, Paylogic International and others.

Authors
=======

`Anatoly Bubenkov <bubenkoff@gmail.com>`_
    original idea and implementation, new features and improvements

These people have contributed to `pytest-splinter`, in alphabetical order:

* `Alessio Bogon <youtux@github.com>`_
* `Andreas Pelme <andreas@pelme.se>`_
* `Andrey Makhnach <andrey.makhnach@gmail.com>`_
* `Aymeric Augustin <https://myks.org/>`_
* `Daniel Hahler <github@thequod.de>`_
* `Hugo van Kemenade <https://github.com/hugovk/>`_
* `Ionel Cristian Mărieș <contact@ionelmc.ro>`_
* `Joshua Fehler <jsfehler@github.com>`_
* `Laurence Rowe <l@lrowe.co.uk>`_
* `Marco Buccini <markon@github.com>`_
* `Michał Pasternak <michal.dtz@gmail.com>`_
* `Michel Sabchuk <michel@sabchuk.com.br>`_
* `Mikko Ohtamaa <mikko@opensourcehacker.com>`_
* `Oleg Pidsadnyi <oleg.pidsadnyi@gmail.com>`_
* `Peter Lauri <peterlauri@gmail.com>`_
* `Suresh V <sureshvv@github.com>`_
* `Tomáš Ehrlich <tomas.ehrlich@gmail.com>`_
* `Tony Narlock <tony@git-pull.com>`_

Changelog
=========

3.3.2
------

- Fix mouse_over patch for Firefox, so it works with recent splinter (0.18.1) (mpasternak),


3.3.1
-----

- Fix handling of command-line option ``splinter_headless`` (mpasternak)

3.3.0
-----

- Support headless firefox (mpasternak)

3.2.0
-----

- Passing `--splinter-headless` without arguments defaults to 'true'
  `#123 <https://github.com/pytest-dev/pytest-splinter/pull/123>`_ (tony)

3.1.0
-----

- Remove unnecessary webdriver patch for retries, this behaviour is now part of splinter. (jsfehler)
- Bump minimum splinter version to 0.13.0 (jsfehler)

3.0.0
-----

- Removed python2 support (bubenkoff)

2.1.0
-----

- Add support for Django and Flask Splinter browsers, that don't have a driver
  attribute `#146 <https://github.com/pytest-dev/pytest-splinter/issues/146>`_
  (michelts)

2.0.1
-----

- Address compatibility with pytest >= 4

2.0.0
-----

- Bump minimum splinter version to 0.9.0 (jsfehler)
- Remove phantomjs support. (jsfehler)

1.9.1
-----

- Fix utf-8 decode warnings when taking screenshots with pytest-xdist active `#108 <https://github.com/pytest-dev/pytest-splinter/issues/108>`_ (jsfehler)


1.9.0
-----

- Use getfixturevalue instead of getfuncargvalue `#97
  <https://github.com/pytest-dev/pytest-splinter/issues/97>`_ (pelme)

- Added Chrome headless support (miohtama)


1.8.6
-----

- Fix screenshots not being taken when used with xdist (youtux)


1.8.5
-----

- Fixed issue with xdist `#94 <https://github.com/pytest-dev/pytest-splinter/issues/94>`_ (bubenkoff)


1.8.3
-----

- Profile does not work with geckodriver+remote webdriver
  `#90 <https://github.com/pytest-dev/pytest-splinter/issues/90>`_) (pelme)


1.8.2
-----

- Fixed missing `switch_to` method (some selenium `expected_conditions` are broken without
  it, see `#93 <https://github.com/pytest-dev/pytest-splinter/pull/93>`_)


1.8.1
-----

- Ensure node's `splinter_failure` always exists (bubenkoff, pelme)
- Correctly handle skipped tests (bubenkoff, schtibe)


1.8.0
-----

- Limit retry behavior for `prepare_browser` (bubenkoff)
- Workaround for cleaning cookies (Edge browser) (bubenkoff)


1.7.8
-----

- Make it possible to override the default value for --splinter-wait-time (magnus-staberg)


1.7.7
-----

- Make it possible to override the default `--splinter-webdriver` (pelme)
- Fix screenshots for function scoped fixtues (pelme)

1.7.6
-----

- Support pytest 3 (bubenkoff)
- Less opionated override of splinter's visit (bubenkoff)

1.7.5
-----

- escape screenshot paths for path separators (bubenkoff)


1.7.4
-----

- use tmpdir_factory to get session scoped tmpdir (RonnyPfannschmidt, bubenkoff)


1.7.3
-----

- fixed Firefox freezing when opening a missing codec extension (olegpidsadnyi)


1.7.2
-----

- fixed taking a screenshot with pytest>=2.9.0 (olegpidsadnyi)


1.7.1
-----

- pytest warnings fixed (firebirdberlin)
- remove firefox firstrun script (aaugustin, bubenkoff)

1.7.0
-----

- add possibility to clean cookies on given domains during the browser cleanup, document cookies cleanup (bubenkoff)

1.6.6
-----

- screenshot encoding made flexible (bubenkoff)

1.6.2
-----

- pass timeout to restored connection (bubenkoff)

1.6.0
-----

- added html screenshot (bubenkoff, blueyed)

1.5.3
-----

- remote webdriver fixes (bubenkoff)

1.5.2
-----

- respect splinter_make_screenshot_on_failure (bubenkoff)

1.5.1
-----

- use native selenium socket timeout feature (pelme)

1.5.0
-----

- pytest tmpdir_factory support (bubenkoff)
- depend on splinter 0.7.3, remove the previous status_code monkey patch (pelme)
- add option `--splinter-wait-time` to specify splinter explicit wait timeout (pelme)

1.4.6
-----

- ensure base tempdir exists (bubenkoff)


1.4.0
-----

- introduce splinter_browser_class fixture (bubenkoff, ecesena)


1.3.8
-----

- correctly handle zope.testbrowser splinter driver (bubenkoff)


1.3.7
-----

- pass `splinter_selenium_implicit_wait` as `wait_time` to splinter Browser (lrowe)


1.3.6
-----

- properly respect webdriver executable command line option (bubenkoff, bh)


1.3.5
-----

- add option --splinter-webdriver-executable for phantomjs and chrome (sureshvv)


1.3.4
-----

- make ``browser_instance_getter`` session scoped, add ``session_browser`` fixture (bubenkoff, sureshvv)


1.3.3
-----

- make ``mouse_over`` comparible with more use-cases (bubenkoff)


1.3.1
-----

- properly handle driver switch during the test run (bubenkoff)
- respect splinter_session_scoped_browser fixture (bubenkoff)


1.2.10
------

- handle exceptions during screenshot saving (blueyed, bubenkoff)
- documentation improvements (blueyed)


1.2.9
-----

- status_code is back in a lazy way (bubenkoff)


1.2.7
-----

- Fix automatic download of pdf content type (bubenkoff)


1.2.4
-----

- fix failing the test run if pytest-xdist is not installed, as it's completely optional dependency (bubenkoff, slafs)


1.2.3
-----

- improve exception handing when preparing the browser instance (bubenkoff)
- require pytest (bubenkoff)


1.2.0
-----

- automatic screenshot capture on test failure (bubenkoff)
- improvements to the browser preparation procedure (bubenkoff)
- boolean config options made more clear (bubenkoff)


1.1.1
-----

- restore browser parameters on each test run instead of once for browser start (bubenkoff)


1.1.0
-----

- added possibility to have multiple browser instances for single test (amakhnach, bubenkoff)


1.0.4
-----

- Fixed browser fixture to support splinter_browser_load_condition and splinter_browser_load_timeout by default. (markon)


1.0.3
-----

- unicode fixes to setup.py (bubenkoff, valberg)


1.0.2
-----

- wait_for_condition now receives pytest_bdd.plugin.Browser object, not selenium webdriver one (bubenkoff)


1.0.1
-----

- Refactoring and cleanup (bubenkoff)


1.0.0
-----

- Initial public release

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/pytest-dev/pytest-splinter",
    "name": "pytest-splinter",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Anatoly Bubenkov, Paylogic International and others",
    "author_email": "bubenkoff@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/76/34/ae72995e7daf734cfcab777108c8ef0c5a83f07314acfd7754f59033c7af/pytest-splinter-3.3.2.tar.gz",
    "platform": null,
    "description": "Splinter plugin for the pytest runner\n======================================\n\n.. image:: https://badges.gitter.im/pytest-dev/pytest-splinter.svg\n   :alt: Join the chat at https://gitter.im/pytest-dev/pytest-splinter\n   :target: https://gitter.im/pytest-dev/pytest-splinter?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge\n\n.. image:: https://img.shields.io/pypi/v/pytest-splinter.svg\n   :target: https://pypi.python.org/pypi/pytest-splinter\n.. image:: https://img.shields.io/pypi/pyversions/pytest-splinter.svg\n  :target: https://pypi.python.org/pypi/pytest-splinter\n.. image:: https://img.shields.io/coveralls/pytest-dev/pytest-splinter/master.svg\n   :target: https://coveralls.io/r/pytest-dev/pytest-splinter\n.. image:: https://github.com/pytest-dev/pytest-splinter/actions/workflows/tests.yml/badge.svg\n        :target: https://github.com/pytest-dev/pytest-splinter/actions\n.. image:: https://readthedocs.org/projects/pytest-splinter/badge/?version=latest\n    :target: https://readthedocs.org/projects/pytest-splinter/?badge=latest\n    :alt: Documentation Status\n\n\nInstall pytest-splinter\n-----------------------\n\n::\n\n    pip install pytest-splinter\n\n\nFeatures\n--------\n\nThe plugin provides a set of fixtures to use `splinter <https://splinter.readthedocs.io>`_\nfor browser testing with `pytest <http://pytest.org>`_\n\n\nFixtures\n--------\n\n* browser\n    Get the splinter's Browser. Fixture is underneath session scoped, so browser process is started\n    once per test session, but the state of the browser will be clean (current page is ``blank``, cookies clean).\n\n* session_browser\n    The same as ``browser`` except the lifetime. This fixture is session-scoped so will only be finalized at the\n    end of the whole test session. Useful if you want to speedup your test suite paying with reduced test isolation.\n\n* browser_instance_getter\n    Function to create an instance of the browser. This fixture is required only if you need to have\n    multiple instances of the Browser in a single test at the same time. Example of usage:\n\n.. code-block:: python\n\n    @pytest.fixture\n    def admin_browser(request, browser_instance_getter):\n        \"\"\"Admin browser fixture.\"\"\"\n        # browser_instance_getter function receives parent fixture -- our admin_browser\n        return browser_instance_getter(request, admin_browser)\n\n    def test_2_browsers(browser, admin_browser):\n        \"\"\"Test using 2 browsers at the same time.\"\"\"\n        browser.visit('http://google.com')\n        admin_browser.visit('http://admin.example.com')\n\n* splinter_selenium_implicit_wait\n    Implicit wait timeout to be passed to Selenium webdriver.\n    Fixture gets the value from the command-line option splinter-implicit-wait (see below)\n\n* splinter_wait_time\n    Explicit wait timeout (for waiting for explicit condition via `wait_for_condition`).\n    Fixture gets the value from the command-line option splinter-wait-time (see below)\n\n* splinter_selenium_speed\n    Speed for Selenium, if not 0 then it will sleep between each selenium command.\n    Useful for debugging/demonstration.\n    Fixture gets the value from the command-line option splinter-speed (see below)\n\n* splinter_selenium_socket_timeout\n    Socket timeout for communication between the webdriver and the browser.\n    Fixture gets the value from the command-line option splinter-socket-timeout (see below)\n\n* splinter_webdriver\n    Splinter's webdriver name to use. Fixture gets the value from the command-line option\n    splinter-webdriver (see below). To make pytest-splinter always use certain webdriver, override a fixture\n    in your `conftest.py` file:\n\n.. code-block:: python\n\n    import pytest\n\n    @pytest.fixture(scope='session')\n    def splinter_webdriver():\n        \"\"\"Override splinter webdriver name.\"\"\"\n        return 'chrome'\n\n* splinter_remote_url\n    Splinter's webdriver remote url to use (optional). Fixture gets the value from the command-line option\n    splinter-remote-url (see below). Will be used only if selected webdriver name is 'remote'.\n\n* splinter_session_scoped_browser\n    pytest-splinter should use single browser instance per test session.\n    Fixture gets the value from the command-line option splinter-session-scoped-browser (see below)\n\n* splinter_file_download_dir\n    Directory, to which browser will automatically download the files it\n    will experience during browsing. For example when you click on some download link.\n    By default it's a temporary directory. Automatic downloading of files is only supported for firefox driver\n    at the moment.\n\n* splinter_download_file_types\n    Comma-separated list of content types to automatically download.\n    By default it's the all known system mime types (via mimetypes standard library).\n\n* splinter_browser_load_condition\n    Browser load condition, python function which should return True.\n    If function returns False, it will be run several times, until timeout below reached.\n\n* splinter_browser_load_timeout\n    Browser load condition timeout in seconds, after this timeout the exception\n    WaitUntilTimeout will be raised.\n\n* splinter_wait_time\n    Browser explicit wait timeout in seconds, after this timeout the exception\n    WaitUntilTimeout will be raised.\n\n* splinter_firefox_profile_preferences\n    Firefox profile preferences, a dictionary which is passed to selenium\n    webdriver's profile_preferences\n\n* splinter_firefox_profile_directory\n    Firefox profile directory to use as template for firefox profile created by selenium.\n    By default, it's an empty directly inside pytest_splinter/profiles/firefox\n\n* splinter_driver_kwargs\n    Webdriver keyword arguments, a dictionary which is passed to selenium\n    webdriver's constructor (after applying firefox preferences)\n    \n.. code-block:: python\n\n    import pytest\n    from pathlib import Path\n    \n    @pytest.fixture\n    def splinter_driver_kwargs():\n        \"\"\"\n        Webdriver kwargs for Firefox.\n        https://selenium-python.readthedocs.io/api.html#module-selenium.webdriver.firefox.webdriver\n        \"\"\"\n        return {\"service_log_path\": Path(\"/log/directory/geckodriver.log\")}\n\nThe snippet below configures Chrome to ignore certificate errors and sets a specific window size\n\n.. code-block:: python\n\n    import pytest\n    from selenium import webdriver\n\n    @pytest.fixture(scope='session')\n    def splinter_driver_kwargs():\n        \"\"\"Override Chrome WebDriver options\"\"\"\n        chrome_options = webdriver.ChromeOptions()\n\n        # List of Chromium Command Line Switches\n        # https://peter.sh/experiments/chromium-command-line-switches/\n        chrome_options.add_argument(\"--window-size=1440,1200\")\n        chrome_options.add_argument(\"--ignore-ssl-errors=yes\")\n        chrome_options.add_argument(\"--ignore-certificate-errors\")\n\n        return {\"options\": chrome_options}\n\n* splinter_window_size\n    Size of the browser window on browser initialization. Tuple in form (<width>, <height>). Default is (1366, 768)\n\n* splinter_screenshot_dir\n    pytest-splinter browser screenshot directory.\n    This fixture gets the value from the command-line option\n    `splinter-screenshot-dir` (see below).\n\n* splinter_make_screenshot_on_failure\n    Should pytest-splinter take browser screenshots on test failure?\n    This fixture gets the value from the command-line option\n    `splinter-make-screenshot-on-failure` (see below).\n\n* splinter_screenshot_encoding\n    Encoding of the `html` `screenshot` on test failure. UTF-8 by default.\n\n* splinter_screenshot_getter_html\n    Function to get browser html screenshot. By default, it saves `browser.html` with given path and\n    `splinter_screenshot_encoding` encoding.\n\n* splinter_screenshot_getter_png\n    Function to get browser image (png) screenshot. By default, it calls `browser.save_sceenshot`\n    with given path.\n\n* splinter_driver_executable\n    Filesystem path of the webdriver executable.\n    This fixture gets the value from the command-line option\n    `splinter-webdriver-executable` (see below).\n\n* splinter_browser_class\n    Class to use for browser instance.\n    Defaults to `pytest_splinter.plugin.Browser`.\n\n* splinter_clean_cookies_urls\n    List of additional urls to clean cookies on. By default, during the preparation of the browser for the test,\n    pytest-splinter only cleans cookies for the last visited url from previous test, as it's not possible to clean\n    all cookies from all domains at once via webdriver protocol, by design. This limitation can be worked around if\n    you know the list of urls, the domains for which you need to clean cookies (for example https://facebook.com).\n    If so, you can override this fixture and put those urls there, and pytest-splinter will visit each of them and will\n    clean the cookies for each domain.\n\n* splinter_headless\n    Run Chrome in headless mode. Defaults to false. http://splinter.readthedocs.io/en/latest/drivers/chrome.html#using-headless-option-for-chrome\n\nCommand-line options\n--------------------\n\n* `--splinter-implicit-wait`\n    Selenium webdriver implicit wait. Seconds (default: 5).\n\n* `--splinter-speed`\n    selenium webdriver speed (from command to command). Seconds (default: 0).\n\n* `--splinter-socket-timeout`\n    Selenium webdriver socket timeout for for communication between the webdriver and the browser.\n    Seconds (default: 120).\n\n* `--splinter-webdriver`\n    Webdriver name to use. (default: firefox). Options:\n\n    *  firefox\n    *  remote\n    *  chrome\n\n    For more details refer to the documentation for splinter and selenium.\n\n* `--splinter-remote-url`\n    Webdriver remote url to use. (default: None). Will be used only if selected webdriver name is 'remote'.\n\n    For more details refer to the documentation for splinter and selenium.\n\n* `--splinter-session-scoped-browser`\n    pytest-splinter should use a single browser instance per test session.\n    Choices are 'true' or 'false' (default: 'true').\n\n* `--splinter-make-screenshot-on-failure`\n    pytest-splinter should take browser screenshots on test failure.\n    Choices are 'true' or 'false' (default: 'true').\n\n* `--splinter-screenshot-dir`\n    pytest-splinter browser screenshot directory. Defaults to the current\n    directory.\n\n* `--splinter-webdriver-executable`\n    Filesystem path of the webdriver executable. Used by chrome driver.\n    Defaults to the None in which case the shell PATH variable setting determines the location of the executable.\n\n* `--splinter-headless`\n    Override `splinter_headless` fixture. Choices are 'true' or 'false', default: 'true'.\n    http://splinter.readthedocs.io/en/latest/drivers/chrome.html#using-headless-option-for-chrome\n    https://splinter.readthedocs.io/en/latest/drivers/firefox.html#using-headless-option-for-firefox\n\nBrowser fixture\n---------------\n\nAs mentioned above, browser is a fixture made by creating splinter's Browser object, but with some overrides.\n\n*  visit\n    Added possibility to wait for condition on each browser visit by having a fixture.\n\n*  wait_for_condition\n    Method copying selenium's wait_for_condition, with difference that condition is in python,\n    so there you can do whatever you want, and not only execute javascript via browser.evaluate_script.\n\n\nAutomatic screenshots on test failure\n-------------------------------------\n\nWhen your functional test fails, it's important to know the reason.\nThis becomes hard when tests are being run on the continuous integration server,\nwhere you cannot debug (using --pdb).\nTo simplify things, a special behaviour of the browser fixture is available,\nwhich takes a screenshot on test failure and puts it in a folder with the a\nnaming convention compatible to the\n`jenkins plugin <https://wiki.jenkins-ci.org/display/JENKINS/JUnit+Attachments+Plugin>`_.\nThe html content of the browser page is also stored, this can be useful for debugging the html source.\n\nCreating screenshots is fully compatible with `pytest-xdist plugin\n<https://pypi.python.org/pypi/pytest-xdist>`_ and will transfer the screenshots\nfrom the worker nodes through the communication channel automatically.\n\nIf a test (using the browser fixture) fails, you should get a screenshot files\nin the following path:\n\n::\n\n    <splinter-screenshot-dir>/my.dotted.name.test.package/test_name-browser.png\n    <splinter-screenshot-dir>/my.dotted.name.test.package/test_name-browser.html\n\nThe `splinter-screenshot-dir` for storing the screenshot is generated by a\nfixture and can be provided through a command line argument, as described above\nat the configuration options section.\n\nTaking screenshots on test failure is enabled by default. It can be controlled\nthrough the `splinter_make_screenshot_on_failure` fixture, where return `False`\nskips it. You can also disable it via a command line argument:\n\n::\n\n    pytest tests/functional --splinter-make-screenshot-on-failure=false\n\nIn case taking a screenshot fails, a pytest warning will be issued, which\ncan be viewed using the `-rw` argument for `pytest`.\n\n\nPython3 support\n---------------\n\nPython3 is supported, check if you have recent version of splinter as it was added recently.\n\n\nExample\n-------\n\ntest_your_test.py:\n\n.. code-block:: python\n\n    def test_some_browser_stuff(browser):\n        \"\"\"Test using real browser.\"\"\"\n        url = \"http://www.google.com\"\n        browser.visit(url)\n        browser.fill('q', 'splinter - python acceptance testing for web applications')\n        # Find and click the 'search' button\n        button = browser.find_by_name('btnK')\n        # Interact with elements\n        button.click()\n        assert browser.is_text_present('splinter.cobrateam.info'), \"splinter.cobrateam.info wasn't found... We need to\"\n        ' improve our SEO techniques'\n\n\nContact\n-------\n\nIf you have questions, bug reports, suggestions, etc. please create an issue on\nthe `GitHub project page <http://github.com/paylogic/pytest-splinter>`_.\n\n\nLicense\n-------\n\nThis software is licensed under the `MIT license <http://en.wikipedia.org/wiki/MIT_License>`_\n\nSee `License file <https://github.com/paylogic/pytest-splinter/blob/master/LICENSE.txt>`_\n\n\n\u00a9 2014 Anatoly Bubenkov, Paylogic International and others.\n\nAuthors\n=======\n\n`Anatoly Bubenkov <bubenkoff@gmail.com>`_\n    original idea and implementation, new features and improvements\n\nThese people have contributed to `pytest-splinter`, in alphabetical order:\n\n* `Alessio Bogon <youtux@github.com>`_\n* `Andreas Pelme <andreas@pelme.se>`_\n* `Andrey Makhnach <andrey.makhnach@gmail.com>`_\n* `Aymeric Augustin <https://myks.org/>`_\n* `Daniel Hahler <github@thequod.de>`_\n* `Hugo van Kemenade <https://github.com/hugovk/>`_\n* `Ionel Cristian M\u0103rie\u0219 <contact@ionelmc.ro>`_\n* `Joshua Fehler <jsfehler@github.com>`_\n* `Laurence Rowe <l@lrowe.co.uk>`_\n* `Marco Buccini <markon@github.com>`_\n* `Micha\u0142 Pasternak <michal.dtz@gmail.com>`_\n* `Michel Sabchuk <michel@sabchuk.com.br>`_\n* `Mikko Ohtamaa <mikko@opensourcehacker.com>`_\n* `Oleg Pidsadnyi <oleg.pidsadnyi@gmail.com>`_\n* `Peter Lauri <peterlauri@gmail.com>`_\n* `Suresh V <sureshvv@github.com>`_\n* `Tom\u00e1\u0161 Ehrlich <tomas.ehrlich@gmail.com>`_\n* `Tony Narlock <tony@git-pull.com>`_\n\nChangelog\n=========\n\n3.3.2\n------\n\n- Fix mouse_over patch for Firefox, so it works with recent splinter (0.18.1) (mpasternak),\n\n\n3.3.1\n-----\n\n- Fix handling of command-line option ``splinter_headless`` (mpasternak)\n\n3.3.0\n-----\n\n- Support headless firefox (mpasternak)\n\n3.2.0\n-----\n\n- Passing `--splinter-headless` without arguments defaults to 'true'\n  `#123 <https://github.com/pytest-dev/pytest-splinter/pull/123>`_ (tony)\n\n3.1.0\n-----\n\n- Remove unnecessary webdriver patch for retries, this behaviour is now part of splinter. (jsfehler)\n- Bump minimum splinter version to 0.13.0 (jsfehler)\n\n3.0.0\n-----\n\n- Removed python2 support (bubenkoff)\n\n2.1.0\n-----\n\n- Add support for Django and Flask Splinter browsers, that don't have a driver\n  attribute `#146 <https://github.com/pytest-dev/pytest-splinter/issues/146>`_\n  (michelts)\n\n2.0.1\n-----\n\n- Address compatibility with pytest >= 4\n\n2.0.0\n-----\n\n- Bump minimum splinter version to 0.9.0 (jsfehler)\n- Remove phantomjs support. (jsfehler)\n\n1.9.1\n-----\n\n- Fix utf-8 decode warnings when taking screenshots with pytest-xdist active `#108 <https://github.com/pytest-dev/pytest-splinter/issues/108>`_ (jsfehler)\n\n\n1.9.0\n-----\n\n- Use getfixturevalue instead of getfuncargvalue `#97\n  <https://github.com/pytest-dev/pytest-splinter/issues/97>`_ (pelme)\n\n- Added Chrome headless support (miohtama)\n\n\n1.8.6\n-----\n\n- Fix screenshots not being taken when used with xdist (youtux)\n\n\n1.8.5\n-----\n\n- Fixed issue with xdist `#94 <https://github.com/pytest-dev/pytest-splinter/issues/94>`_ (bubenkoff)\n\n\n1.8.3\n-----\n\n- Profile does not work with geckodriver+remote webdriver\n  `#90 <https://github.com/pytest-dev/pytest-splinter/issues/90>`_) (pelme)\n\n\n1.8.2\n-----\n\n- Fixed missing `switch_to` method (some selenium `expected_conditions` are broken without\n  it, see `#93 <https://github.com/pytest-dev/pytest-splinter/pull/93>`_)\n\n\n1.8.1\n-----\n\n- Ensure node's `splinter_failure` always exists (bubenkoff, pelme)\n- Correctly handle skipped tests (bubenkoff, schtibe)\n\n\n1.8.0\n-----\n\n- Limit retry behavior for `prepare_browser` (bubenkoff)\n- Workaround for cleaning cookies (Edge browser) (bubenkoff)\n\n\n1.7.8\n-----\n\n- Make it possible to override the default value for --splinter-wait-time (magnus-staberg)\n\n\n1.7.7\n-----\n\n- Make it possible to override the default `--splinter-webdriver` (pelme)\n- Fix screenshots for function scoped fixtues (pelme)\n\n1.7.6\n-----\n\n- Support pytest 3 (bubenkoff)\n- Less opionated override of splinter's visit (bubenkoff)\n\n1.7.5\n-----\n\n- escape screenshot paths for path separators (bubenkoff)\n\n\n1.7.4\n-----\n\n- use tmpdir_factory to get session scoped tmpdir (RonnyPfannschmidt, bubenkoff)\n\n\n1.7.3\n-----\n\n- fixed Firefox freezing when opening a missing codec extension (olegpidsadnyi)\n\n\n1.7.2\n-----\n\n- fixed taking a screenshot with pytest>=2.9.0 (olegpidsadnyi)\n\n\n1.7.1\n-----\n\n- pytest warnings fixed (firebirdberlin)\n- remove firefox firstrun script (aaugustin, bubenkoff)\n\n1.7.0\n-----\n\n- add possibility to clean cookies on given domains during the browser cleanup, document cookies cleanup (bubenkoff)\n\n1.6.6\n-----\n\n- screenshot encoding made flexible (bubenkoff)\n\n1.6.2\n-----\n\n- pass timeout to restored connection (bubenkoff)\n\n1.6.0\n-----\n\n- added html screenshot (bubenkoff, blueyed)\n\n1.5.3\n-----\n\n- remote webdriver fixes (bubenkoff)\n\n1.5.2\n-----\n\n- respect splinter_make_screenshot_on_failure (bubenkoff)\n\n1.5.1\n-----\n\n- use native selenium socket timeout feature (pelme)\n\n1.5.0\n-----\n\n- pytest tmpdir_factory support (bubenkoff)\n- depend on splinter 0.7.3, remove the previous status_code monkey patch (pelme)\n- add option `--splinter-wait-time` to specify splinter explicit wait timeout (pelme)\n\n1.4.6\n-----\n\n- ensure base tempdir exists (bubenkoff)\n\n\n1.4.0\n-----\n\n- introduce splinter_browser_class fixture (bubenkoff, ecesena)\n\n\n1.3.8\n-----\n\n- correctly handle zope.testbrowser splinter driver (bubenkoff)\n\n\n1.3.7\n-----\n\n- pass `splinter_selenium_implicit_wait` as `wait_time` to splinter Browser (lrowe)\n\n\n1.3.6\n-----\n\n- properly respect webdriver executable command line option (bubenkoff, bh)\n\n\n1.3.5\n-----\n\n- add option --splinter-webdriver-executable for phantomjs and chrome (sureshvv)\n\n\n1.3.4\n-----\n\n- make ``browser_instance_getter`` session scoped, add ``session_browser`` fixture (bubenkoff, sureshvv)\n\n\n1.3.3\n-----\n\n- make ``mouse_over`` comparible with more use-cases (bubenkoff)\n\n\n1.3.1\n-----\n\n- properly handle driver switch during the test run (bubenkoff)\n- respect splinter_session_scoped_browser fixture (bubenkoff)\n\n\n1.2.10\n------\n\n- handle exceptions during screenshot saving (blueyed, bubenkoff)\n- documentation improvements (blueyed)\n\n\n1.2.9\n-----\n\n- status_code is back in a lazy way (bubenkoff)\n\n\n1.2.7\n-----\n\n- Fix automatic download of pdf content type (bubenkoff)\n\n\n1.2.4\n-----\n\n- fix failing the test run if pytest-xdist is not installed, as it's completely optional dependency (bubenkoff, slafs)\n\n\n1.2.3\n-----\n\n- improve exception handing when preparing the browser instance (bubenkoff)\n- require pytest (bubenkoff)\n\n\n1.2.0\n-----\n\n- automatic screenshot capture on test failure (bubenkoff)\n- improvements to the browser preparation procedure (bubenkoff)\n- boolean config options made more clear (bubenkoff)\n\n\n1.1.1\n-----\n\n- restore browser parameters on each test run instead of once for browser start (bubenkoff)\n\n\n1.1.0\n-----\n\n- added possibility to have multiple browser instances for single test (amakhnach, bubenkoff)\n\n\n1.0.4\n-----\n\n- Fixed browser fixture to support splinter_browser_load_condition and splinter_browser_load_timeout by default. (markon)\n\n\n1.0.3\n-----\n\n- unicode fixes to setup.py (bubenkoff, valberg)\n\n\n1.0.2\n-----\n\n- wait_for_condition now receives pytest_bdd.plugin.Browser object, not selenium webdriver one (bubenkoff)\n\n\n1.0.1\n-----\n\n- Refactoring and cleanup (bubenkoff)\n\n\n1.0.0\n-----\n\n- Initial public release\n",
    "bugtrack_url": null,
    "license": "MIT license",
    "summary": "Splinter plugin for pytest testing framework",
    "version": "3.3.2",
    "project_urls": {
        "Bug Tracker": "https://github.com/pytest-dev/pytest-splinter/issues",
        "Changes": "https://github.com/pytest-dev/pytest-splinter/blob/master/CHANGES.rst",
        "Documentation": "https://github.com/pytest-dev/pytest-splinter/blob/master/README.rst",
        "Homepage": "https://github.com/pytest-dev/pytest-splinter",
        "Source Code": "https://github.com/pytest-dev/pytest-splinter"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5f9c5721cf540d8e48c6721b0679eaa853048a7796ac03c4cec7c430cd92cbf8",
                "md5": "503310438c9cd00d9497ebb6c48ebedf",
                "sha256": "8ec3094e42c70c7b4aa27834918cfa96e4c0d453c8e7a3055777bc061f976244"
            },
            "downloads": -1,
            "filename": "pytest_splinter-3.3.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "503310438c9cd00d9497ebb6c48ebedf",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 18292,
            "upload_time": "2022-09-09T19:46:51",
            "upload_time_iso_8601": "2022-09-09T19:46:51.419014Z",
            "url": "https://files.pythonhosted.org/packages/5f/9c/5721cf540d8e48c6721b0679eaa853048a7796ac03c4cec7c430cd92cbf8/pytest_splinter-3.3.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7634ae72995e7daf734cfcab777108c8ef0c5a83f07314acfd7754f59033c7af",
                "md5": "212b3053532ab9fb6838b1521aafdcb4",
                "sha256": "8a2aadab4be040a763865ac33e37a118194ddba746c6a91183d728ff65f63308"
            },
            "downloads": -1,
            "filename": "pytest-splinter-3.3.2.tar.gz",
            "has_sig": false,
            "md5_digest": "212b3053532ab9fb6838b1521aafdcb4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 24124,
            "upload_time": "2022-09-09T19:46:54",
            "upload_time_iso_8601": "2022-09-09T19:46:54.963667Z",
            "url": "https://files.pythonhosted.org/packages/76/34/ae72995e7daf734cfcab777108c8ef0c5a83f07314acfd7754f59033c7af/pytest-splinter-3.3.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-09-09 19:46:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pytest-dev",
    "github_project": "pytest-splinter",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "tox": true,
    "lcname": "pytest-splinter"
}
        
Elapsed time: 0.18029s