Skip to main content

Pytest plugin to facilitate screenshot taking with selenium webdriver

Reason this release was yanked:

Transfered ownership

Project description

pyshot

Pytest plugin to facilitate screenshot taking with selenium webdriver.

Installation

pip install pyshot

Usage

First you need to add the configuration file pyshot.conf file.

[pyshot]
screenshots_path = C:/Users/angel/OneDrive/Documentos/projects/pyshot/screenshots
only_pyshot_steps = false
create_folder_per_testcase = true

screenshots_path: Absolute path of the folder where the screenshots will be saved. It shouldn't have a / at the end.

only_pyshot_steps: When it is activated (true) only the functions marked with the decorator @pyshot_step will be screenshoted.

create_folder_per_testcase: When it is activated (true) a new folder will be created automatically to save the screenshots of the testcase.

Once you have created the pyshot.conf file add a fixture with the decorator @pyshot_driver that returns the driver you will to use during test execution, like this:

@pytest.fixture(scope="module", autouse=True)
@pyshot_driver
def chrome_driver():
    driver = webdriver.Chrome(ChromeDriverManager().install())
    return driver

If you want to take screenshots only on certain steps of the execution, activate the option only_pyshot_steps on the pyshot.conf and add the decorator @pyshot_step on the functions where you want to take screenshots.

@pyshot_step
def search(cls, search_text: str):
    SearchPage.enter_search_text(search_text)
    SearchPage.make_search()

Once you have configured everything within your repo add the argument --pyshot_conf with the path to your pyshot.conf file.

pytest test_example.py --pyshot_conf=usr/test/pyshot.conf

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyshot-0.0.1.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

pyshot-0.0.1-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file pyshot-0.0.1.tar.gz.

File metadata

  • Download URL: pyshot-0.0.1.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.10

File hashes

Hashes for pyshot-0.0.1.tar.gz
Algorithm Hash digest
SHA256 78c8e6b76d6d52e1a6af029ed4b50aa22bbbf3ca0114c4902fb9afb7cfb3a633
MD5 d1b676414d9752d88699084324208325
BLAKE2b-256 ebf2fcd23f86874f0ea9c1a64a499d0675f00e7abd192cbad0fb93b7b44eb5ff

See more details on using hashes here.

Provenance

File details

Details for the file pyshot-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pyshot-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.10

File hashes

Hashes for pyshot-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8740bf73b14bce977af6ca1b7399155ccbf86df63588b0ed0b4887881fa984d3
MD5 a63c3164e2cdaa0af08f446c8977f0eb
BLAKE2b-256 d416050450765834d105c8e73505fc30c6343b5b8be5db4560639e952698781e

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page