module SeleniumRecord::Waits::ClassMethods

Utilities for waiting methods

Public Instance Methods

js_inactive_script() click to toggle source

@return [String] the string containing javascript code to be evaluated

to check if there are ajax calls pending
# File lib/selenium_record/waits.rb, line 93
def js_inactive_script
  {
    jquery: 'return $.active'
  }[Configuration.js_library]
end
seconds_for(opts) click to toggle source
# File lib/selenium_record/waits.rb, line 99
def seconds_for(opts)
  seconds = opts[:seconds]
  return seconds if seconds
  20
end
wait_for(seconds = DEFAULT_WAITING_TIME) { || ... } click to toggle source

Wait selenium execution until a condition take place @raise [Selenium::WebDriver::Error::TimeOutError] if the precondition we

are waiting for doesn't take place after completing the wait period

@param seconds [Integer] number of seconds to wait @yieldreturn [Boolean] marks whether the condition we are waiting for

passes
# File lib/selenium_record/waits.rb, line 87
def wait_for(seconds = DEFAULT_WAITING_TIME)
  Selenium::WebDriver::Wait.new(timeout: seconds).until { yield }
end