Class: MiniAutobot::PageObjects::Widgets::Base
- Inherits:
-
Object
- Object
- MiniAutobot::PageObjects::Widgets::Base
- Extended by:
- ElementContainer
- 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
- #find_all(how, what) ⇒ Object
- #find_first(how, what) ⇒ Object
-
#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 ElementContainer
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, #take_screenshot, #teardown, #update_sauce_session_name, #update_sauce_session_status, #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.
16 17 18 19 20 |
# File 'lib/mini_autobot/page_objects/widgets/base.rb', line 16 def initialize(page, element) @driver = page.driver @page = page @element = element end |
Instance Attribute Details
#driver ⇒ Object (readonly)
Returns the value of attribute driver.
14 15 16 |
# File 'lib/mini_autobot/page_objects/widgets/base.rb', line 14 def driver @driver end |
#element ⇒ Object (readonly)
Returns the value of attribute element.
14 15 16 |
# File 'lib/mini_autobot/page_objects/widgets/base.rb', line 14 def element @element end |
#page ⇒ Object (readonly)
Returns the value of attribute page.
14 15 16 |
# File 'lib/mini_autobot/page_objects/widgets/base.rb', line 14 def page @page end |
Instance Method Details
#find_all(how, what) ⇒ Object
31 32 33 |
# File 'lib/mini_autobot/page_objects/widgets/base.rb', line 31 def find_all(how, what) element.all(how, what) end |
#find_first(how, what) ⇒ Object
27 28 29 |
# File 'lib/mini_autobot/page_objects/widgets/base.rb', line 27 def find_first(how, what) element.find_element(how, what) end |
#page_object ⇒ Object
for widgets that include Utils::OverlayAndWidgetHelper
23 24 25 |
# File 'lib/mini_autobot/page_objects/widgets/base.rb', line 23 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
39 40 41 42 43 44 45 46 |
# File 'lib/mini_autobot/page_objects/widgets/base.rb', line 39 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 |