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

Keybase proof

I hereby claim:

  • I am krizo on github.
  • I am krizo (https://keybase.io/krizo) on keybase.
  • I have a public key ASC7f0L_tMADSa0BMeVZ8sWAX9tUFWJjq6ynGJBdVCzJKgo

To claim this, I am signing this object:

require "spec_helper"
class SalesValues
attr_accessor :total_sales_value, :account_sales_value, :account_total_value_in_timeframe
def initialize
@total_sales_value = @account_sales_value = @account_total_value_in_timeframe = 0
end
end
ALL_TIMEFRAMES = [:today, :yesterday, :this_month, :this_week, :last_month, :last_week]