class Capybara::Node::Base

def catch_error?(error, errors = nil)

def catch_error?(error, errors = nil)
  errors ||= (driver.invalid_element_errors + [Capybara::ElementNotFound])
  errors.any? { |type| error.is_a?(type) }
end

def driver

def driver
  session.driver
end

def find_css(css)

Other tags:
    Api: - private
def find_css(css)
  base.find_css(css)
end

def find_xpath(xpath)

Other tags:
    Api: - private
def find_xpath(xpath)
  base.find_xpath(xpath)
end

def initialize(session, base)

def initialize(session, base)
  @session = session
  @base = base
end

def reload

overridden in subclasses, e.g. Capybara::Node::Element
def reload
  self
end

def session_options

Other tags:
    Api: - private
def session_options
  session.config
end

def synchronize(seconds = session_options.default_max_wait_time, errors: nil)

Raises:
  • (Capybara::FrozenInTime) - If the return value of `Time.now` appears stuck

Returns:
  • (Object) - The result of the given block

Parameters:
  • errors (Array) -- (driver.invalid_element_errors +
  • seconds (Integer) -- (current sessions default_max_wait_time) Maximum number of seconds to retry this block
def synchronize(seconds = session_options.default_max_wait_time, errors: nil)
  return yield if session.synchronized
  session.synchronized = true
  timer = Capybara::Helpers.timer(expire_in: seconds)
  begin
    yield
  rescue StandardError => err
    session.raise_server_error!
    raise err unless driver.wait? && catch_error?(err, errors)
    raise err if timer.expired?
    sleep(0.05)
    reload if session_options.automatic_reload
    retry
  ensure
    session.synchronized = false
  end
end

def to_capybara_node

def to_capybara_node
  self
end