Module: Cornucopia::Capybara::MatcherExtensions

Extended by:
ActiveSupport::Concern
Defined in:
lib/cornucopia/capybara/matcher_extensions.rb

Instance Method Summary collapse

Instance Method Details

#__cornucopia_assert_selector_function(assert_selector_function, *args) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/cornucopia/capybara/matcher_extensions.rb', line 50

def __cornucopia_assert_selector_function(assert_selector_function, *args)
  retry_count = 0
  result      = nil

  support_options = if [:has_selector?, :has_no_selector?].include?(assert_selector_function)
                      {}
                    else
                      __cornucopia__extract_selector_support_options(*args)
                    end

  begin
    retry_count += 1
    result      = send("__cornucopia_orig_#{assert_selector_function}", *args)
  rescue Selenium::WebDriver::Error::StaleElementReferenceError
    retry if __cornucopia__retry_selector(retry_count, support_options)

    result = __cornucopia__analyze_selector(assert_selector_function, support_options, *args)
  rescue Exception
    result = __cornucopia__analyze_selector(assert_selector_function, support_options, *args)
  end

  result
end