Skip to main content

Enhancement to Selenium WebDriver for timeouts and more.

Project description

Selenious

version downloads sanity docs

Enhances Selenium with timeouts and recover capabilities.

Introduction

Selenious enhances Selenium WebDriver find_element* functions to have a timeout, poll_frequency, and recover. The find_elements* functions are additionally enhanced with debounce and min settings.

Selenium already has an implicitly_wait and a WebDriverWait function. Neither of these have the versatility and natural feel that Selenious gives the code. To add a 5 second timeout to a single call, Selenious would be::

driver.find_element_by_id('popup', timeout=5)

While with implicitly_wait the code would be::

driver.implicitly_wait(5)
driver.find_element_by_id('popup')
driver.implicitly_wait(hopefully_you_know_what_the_setting_was_before)

And WebDriverWait would be::

WebDriverWait(driver, 5).until(
    EC.presence_of_element_located((By.ID, "popup"))
)

Features

Enhancement to the find_element function

  • timeout - The maximum time in seconds to wait for a succesful find.

  • poll_frequency - How often to poll the driver for the element

  • debounce - For find_elements* wait for this time period for the count to not change.

  • min - For find_elements* the minimum count to find.

  • recover - If the item or min items are not found, call this periodically and try again.

Drop-in replacement for selenium webdriver

Instead of from selenium.webdriver import Chrome a convenience of from selenious.webdriver import Chrome can be used that imports the SeleniousMixin for you.

Settings can be set in the function or globally

Locally, webdriver.find_element_by_id('id', timeout=5), or globaly, webdriver.timeout = 5.

Support of recover() for click()

If a click() command raises an exception, if set, the recover() function will be called once and the click attempted again. This allows for recovering from such events as a modal popup being shown or the button has scrolled out of view.

No deprecation of the find_element[s]by* methods

The developers of selenium have made the decision to deprecate redundant functions such as find_element_by_id(id_) with the common function and a By parameter. find_element(By.ID, id_). Selenious will continue to support these convenience functions and not print a warning.

Credits

This package was created with Cookiecutter_ and the audreyr/cookiecutter-pypackage_ project template.

History


0.2.1 (2021-11-30)

  • Documentation enhancements

0.2.0 (2021-11-28)

  • Add element.find_element[s]*() function support.

  • Add element.click() recover support.

0.1.0 (2020-10-11)

  • First release on PyPI.

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

selenious-0.2.1.tar.gz (15.8 kB view details)

Uploaded Source

Built Distribution

selenious-0.2.1-py2.py3-none-any.whl (20.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file selenious-0.2.1.tar.gz.

File metadata

  • Download URL: selenious-0.2.1.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for selenious-0.2.1.tar.gz
Algorithm Hash digest
SHA256 1cf4567f2d70044cd8765d180e03798081bcf778cdcd517c3d64e90718bb2cf5
MD5 541ac03e3f7d02340a3847ff3fbfbdd7
BLAKE2b-256 a4bc41957583db8296049df799dc820b57eb8566cf50b9dde5bf8497402960fa

See more details on using hashes here.

File details

Details for the file selenious-0.2.1-py2.py3-none-any.whl.

File metadata

  • Download URL: selenious-0.2.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 20.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for selenious-0.2.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 70235a57822ff43a358bfc79cb13b63439e811892b462c955e1deaa9db3c6613
MD5 dbddcb752b9bbe219b4efd7ba89d79cd
BLAKE2b-256 8c9e5bc053cf56df342acc1f05a5be10a3f0b71e346b7353c9f4410b2a634bec

See more details on using hashes here.

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