class Selenium::WebDriver::Wait
def current_time
def current_time Process.clock_gettime(Process::CLOCK_MONOTONIC) end
def initialize(opts = {})
def initialize(opts = {}) @timeout = opts.fetch(:timeout, DEFAULT_TIMEOUT) @interval = opts.fetch(:interval, DEFAULT_INTERVAL) @message = opts[:message] @ignored = Array(opts[:ignore] || Error::NoSuchElementError) end
def until
def until end_time = current_time + @timeout last_error = nil until current_time > end_time begin result = yield return result if result rescue *@ignored => last_error # rubocop:disable Naming/RescuedExceptionsVariableName # swallowed end sleep @interval end msg = if @message @message.dup else +"timed out after #{@timeout} seconds" end msg << " (#{last_error.message})" if last_error raise Error::TimeoutError, msg end