Class: MiniAutobot::PageObjects::Widgets::Base
- Inherits:
-
Object
- Object
- MiniAutobot::PageObjects::Widgets::Base
- Defined in:
- lib/mini_autobot/page_objects/widgets/base.rb
Overview
A widget represents a portion (an element) of a page that is repeated or reproduced multiple times, either on the same page, or across multiple page objects or page modules.
Instance Attribute Summary collapse
-
#driver ⇒ Object
readonly
Returns the value of attribute driver.
-
#element ⇒ Object
readonly
Returns the value of attribute element.
-
#page ⇒ Object
readonly
Returns the value of attribute page.
Instance Method Summary collapse
-
#initialize(page, element) ⇒ Base
constructor
A new instance of Base.
-
#page_object ⇒ Object
for widgets that include Utils::OverlayAndWidgetHelper.
-
#wait(opts = {}) ⇒ Object
Explicitly wait for a certain condition to be true: wait.until { driver.find_element(:css, ‘body.tmpl-srp’) } when timeout is not specified, default timeout 5 sec will be used when timeout is larger than 15, max timeout 15 sec will be used.
Methods included from Utils::OverlayAndWidgetHelper
Methods included from Utils::PageObjectHelper
#connector_is_saucelabs?, #current_page, #is_element_present?, #is_element_present_and_displayed?, #json_save_to_ever_failed, #print_sauce_link, #put_value, #read_yml, #retry_with_count, #save_to_ever_failed, #take_screenshot, #teardown, #update_sauce_session, #wait_for_attribute_to_have_value, #wait_for_element_to_be_present, #wait_for_element_to_display, #with_url_change_wait
Methods included from Utils::Castable
Constructor Details
#initialize(page, element) ⇒ Base
Returns a new instance of Base.
15 16 17 18 19 |
# File 'lib/mini_autobot/page_objects/widgets/base.rb', line 15 def initialize(page, element) @driver = page.driver @page = page @element = element end |
Instance Attribute Details
#driver ⇒ Object (readonly)
Returns the value of attribute driver.
13 14 15 |
# File 'lib/mini_autobot/page_objects/widgets/base.rb', line 13 def driver @driver end |
#element ⇒ Object (readonly)
Returns the value of attribute element.
13 14 15 |
# File 'lib/mini_autobot/page_objects/widgets/base.rb', line 13 def element @element end |
#page ⇒ Object (readonly)
Returns the value of attribute page.
13 14 15 |
# File 'lib/mini_autobot/page_objects/widgets/base.rb', line 13 def page @page end |
Instance Method Details
#page_object ⇒ Object
for widgets that include Utils::OverlayAndWidgetHelper
22 23 24 |
# File 'lib/mini_autobot/page_objects/widgets/base.rb', line 22 def page_object @page end |
#wait(opts = {}) ⇒ Object
Explicitly wait for a certain condition to be true:
wait.until { driver.find_element(:css, 'body.tmpl-srp') }
when timeout is not specified, default timeout 5 sec will be used when timeout is larger than 15, max timeout 15 sec will be used
33 34 35 36 37 38 39 40 |
# File 'lib/mini_autobot/page_objects/widgets/base.rb', line 33 def wait(opts = {}) if !opts[:timeout].nil? && opts[:timeout] > 15 puts "WARNING: #{opts[:timeout]} sec timeout is NOT supported by wait method, max timeout 15 sec will be used instead" opts[:timeout] = 15 end Selenium::WebDriver::Wait.new(opts) end |