Module: Howitzer::Web::CapybaraMethodsProxy

Included in:
BaseSection, Page
Defined in:
lib/howitzer/web/capybara_methods_proxy.rb

Overview

This module proxies required original capybara methods to recipient

Constant Summary collapse

PROXIED_CAPYBARA_METHODS =

:nodoc:

Capybara::Session::SESSION_METHODS + #:nodoc:
Capybara::Session::MODAL_METHODS +
i[driver text]

Instance Method Summary collapse

Instance Method Details

#click_alert_box(flag) ⇒ Object

Accepts or declines JS alert box by given flag


48
49
50
51
52
53
54
55
# File 'lib/howitzer/web/capybara_methods_proxy.rb', line 48

def click_alert_box(flag)
  if %w[selenium sauce].include? Howitzer.driver
    alert = driver.browser.switch_to.alert
    flag ? alert.accept : alert.dismiss
  else
    evaluate_script("window.confirm = function() { return #{flag}; }")
  end
end