class Browsery::PageObjects::Widgets::Base
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.
Attributes
driver[R]
element[R]
page[R]
Public Class Methods
new(page, element)
click to toggle source
# File lib/browsery/page_objects/widgets/base.rb, line 16 def initialize(page, element) @driver = page.driver @page = page @element = element end
Public Instance Methods
find_all(how, what)
click to toggle source
# File lib/browsery/page_objects/widgets/base.rb, line 31 def find_all(how, what) element.all(how, what) end
find_first(how, what)
click to toggle source
# File lib/browsery/page_objects/widgets/base.rb, line 27 def find_first(how, what) element.find_element(how, what) end
page_object()
click to toggle source
for widgets that include Utils::OverlayAndWidgetHelper
# File lib/browsery/page_objects/widgets/base.rb, line 23 def page_object @page end
wait(opts = {})
click to toggle source
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
# File lib/browsery/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