Skip to content

Instantly share code, notes, and snippets.

View krizo's full-sized avatar

Krzysztof Bober krizo

  • Engenious, Inexto
  • Cracow, Poland
View GitHub Profile
@krizo
krizo / page_objects.py
Created March 2, 2020 20:56 — forked from danizen/page_objects.py
enhance selenium page objects with wait capability and caching
"""
Adapted from the page-objects Python package addressing two perceived shortfalls:
- Lack of an easy way to get at the locator for a field, for instance for waits.
- Extra calls to driver.find_element() without any caching.
The API of this module is mostly backwards compatible with page-objects, with the following differences:
- The `root_uri` kwarg or PageObject is deprecated in favor of `base_url`, but root_uri is still supported.
- The behavior where setting the attribute sends keys seems to obscure the selenium bindings for selenium,
and are too magical, so they are removed.
- The factory methods at end are removed, because I never used it with factory methods