{"id":16252212,"url":"https://github.com/jsfehler/pytest-splinter4","last_synced_at":"2025-06-29T05:33:50.112Z","repository":{"id":38017488,"uuid":"440592596","full_name":"jsfehler/pytest-splinter4","owner":"jsfehler","description":"Pytest plugin to use the splinter automation library.","archived":false,"fork":false,"pushed_at":"2024-06-11T15:26:35.000Z","size":243,"stargazers_count":1,"open_issues_count":4,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-13T05:02:01.064Z","etag":null,"topics":["automation","pytest","python","selenium","splinter"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jsfehler.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.rst","dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-12-21T17:05:26.000Z","updated_at":"2024-06-10T20:39:17.000Z","dependencies_parsed_at":"2025-06-13T05:01:50.526Z","dependency_job_id":"ff2263fa-f5e3-4432-96e7-4f6f93e4fa43","html_url":"https://github.com/jsfehler/pytest-splinter4","commit_stats":{"total_commits":257,"total_committers":30,"mean_commits":8.566666666666666,"dds":"0.45914396887159536","last_synced_commit":"e2b5b68a079476192cd3c98102cb80c41da742da"},"previous_names":[],"tags_count":69,"template":false,"template_full_name":null,"purl":"pkg:github/jsfehler/pytest-splinter4","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsfehler%2Fpytest-splinter4","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsfehler%2Fpytest-splinter4/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsfehler%2Fpytest-splinter4/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsfehler%2Fpytest-splinter4/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jsfehler","download_url":"https://codeload.github.com/jsfehler/pytest-splinter4/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsfehler%2Fpytest-splinter4/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262543862,"owners_count":23326626,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","pytest","python","selenium","splinter"],"created_at":"2024-10-10T15:12:48.482Z","updated_at":"2025-06-29T05:33:50.087Z","avatar_url":"https://github.com/jsfehler.png","language":"Python","readme":"pytest-splinter4\n================\n\nA `pytest \u003chttp://pytest.org\u003e`_ plugin for `splinter \u003chttps://splinter.readthedocs.io\u003e`_.\n\npytest-splinter4 is a fork of `pytest-splinter \u003chttps://github.com/pytest-dev/pytest-splinter\u003e`_\nwith added features and fixes to support newer versions of\n``pytest``, ``pytest-xdist``, ``splinter \u003e= 0.17.0``, and ``selenium \u003e= 4.0``.\n\n.. image:: https://img.shields.io/pypi/v/pytest-splinter4.svg\n    :alt: PyPI\n    :target: https://pypi.python.org/pypi/pytest-splinter4\n\n.. image:: https://img.shields.io/pypi/pyversions/pytest-splinter4.svg\n    :alt: PyPI - Python Version\n    :target: https://pypi.python.org/pypi/pytest-splinter4\n\n.. image:: https://img.shields.io/github/license/jsfehler/pytest-splinter4.svg\n    :alt: GitHub\n    :target: https://github.com/jsfehler/pytest-splinter4/blob/master/LICENSE\n\n.. image:: https://github.com/jsfehler/pytest-splinter4/workflows/CI/badge.svg\n    :target: https://github.com/jsfehler/pytest-splinter4/actions/workflows/main.yml\n    :alt: Build status\n\n.. image:: https://codecov.io/gh/jsfehler/pytest-splinter4/branch/master/graph/badge.svg?token=C1vfu8YgWn\n   :target: https://codecov.io/gh/jsfehler/pytest-splinter4\n\n.. image:: https://readthedocs.org/projects/pytest-splinter4/badge/?version=latest\n    :target: https://readthedocs.org/projects/pytest-splinter4/?badge=latest\n    :alt: Documentation Status\n\n\nInstallation\n------------\n\n.. code-block:: bash\n\n    python -m pip install pytest-splinter4\n\n\nFeatures\n--------\n\nSensible Defaults\n+++++++++++++++++\n\n\nDriver executable_path argument\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nWhen using chrome, firefox, or edge, the `executable_path` driver argument has\na default value set to also search for chrome/gecko/edgedriver in the current working directory.\n\n\nBrowser Fixtures\n++++++++++++++++\n\nThe following fixtures provide instances of ``splinter.Browser()``\n\n* browser\n    A new instance of splinter's Browser. Fixture is 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:\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\nSelenium Fixtures\n+++++++++++++++++\n\nThe following fixtures provide support for selenium parameters.\nThey are only used when Selenium based drivers are used.\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_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\nSplinter Fixtures\n+++++++++++++++++\n\nThe following fixtures provide support for splinter parameters.\n\n* splinter_wait_time\n    Explicit wait timeout (for waiting for explicit condition via `wait_for_condition`).\n    Default value is from the command-line option splinter-wait-time (see below)\n\n* splinter_webdriver\n    Splinter's webdriver name to use. Default value is from the command-line option\n    splinter-webdriver (see below).\n\n    To make pytest-splinter always use certain webdriver, override a fixture\n    in your `conftest.py` file. Example:\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    Webdriver remote url to use. Default value is from the command-line option\n    splinter-remote-url (see below).\n\n    This will only be used if the selected webdriver name is 'remote'.\n\n* splinter_remote_name\n    Name of the browser to use when running Remote Webdriver.\n\n    This will be used only if the selected webdriver name is 'remote'.\n\n* splinter_session_scoped_browser\n    Use a single browser instance per test session.\n    Default value is 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, a 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_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\n* splinter_window_size\n    Size of the browser window on browser initialization. Tuple in form (\u003cwidth\u003e, \u003cheight\u003e). Default is (1366, 768)\n\n* splinter_logs_dir\n    Driver logs directory. Default is 'logs'.\n\n* splinter_screenshot_dir\n    Browser screenshot directory. Default is 'logs/{test_function_name}'.\n\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_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\nFirefox Only\n~~~~~~~~~~~~\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\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-remote-name`\n    Name of the browser to use when running Remote Webdriver.\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-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, the ``browser`` fixture is an instance of splinter's Browser object,\nbut 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 a 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 \u003chttps://wiki.jenkins-ci.org/display/JENKINS/JUnit+Attachments+Plugin\u003e`_.\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\u003chttps://pypi.python.org/pypi/pytest-xdist\u003e`_ 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    \u003csplinter-screenshot-dir\u003e/my.dotted.name.test.package/test_name-browser.png\n    \u003csplinter-screenshot-dir\u003e/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\nExample\n-------\n\n.. code-block:: python\n\n    def test_using_a_browser(browser):\n        \"\"\"Test using real browser.\"\"\"\n        url = \"http://www.google.com\"\n        browser.visit(url)\n\n        browser.fill('q', 'splinter - python acceptance testing for web applications')\n\n        # Find and click the 'search' button\n        button = browser.find_by_name('btnK')\n\n        # Interact with elements\n        button.click()\n\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 \u003chttp://github.com/jsfehler/pytest-splinter4\u003e`_.\n\n\nLicense\n-------\n\nThis software is licensed under the `MIT license \u003chttp://en.wikipedia.org/wiki/MIT_License\u003e`_\n\nSee `License file \u003chttps://github.com/jsfehler/pytest-splinter4/blob/master/LICENSE.txt\u003e`_\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsfehler%2Fpytest-splinter4","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjsfehler%2Fpytest-splinter4","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsfehler%2Fpytest-splinter4/lists"}