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, **options)
- Api: - private
def find_css(css, **options) if base.method(:find_css).arity == 1 base.find_css(css) else base.find_css(css, **options) end end
def find_xpath(xpath, **options)
- Api: - private
def find_xpath(xpath, **options) if base.method(:find_xpath).arity == 1 base.find_xpath(xpath) else base.find_xpath(xpath, **options) end end
def initialize(session, base)
def initialize(session, base) @session = session @base = base end
def reload
def reload self end
def session_options
- Api: - private
def session_options session.config end
def synchronize(seconds = nil, errors: nil)
-
(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 = nil, errors: nil) return yield if session.synchronized seconds = session_options.default_max_wait_time if [nil, true].include? seconds interval = session_options.default_retry_interval session.synchronized = true timer = Capybara::Helpers.timer(expire_in: seconds) begin yield rescue StandardError => e session.raise_server_error! raise e unless catch_error?(e, errors) if driver.wait? raise e if timer.expired? sleep interval reload if session_options.automatic_reload else old_base = @base reload if session_options.automatic_reload raise e if old_base == @base end retry ensure session.synchronized = false end end
def to_capybara_node
def to_capybara_node self end