Module: Capybara::BasicAuthHelper

Defined in:
lib/capybara/basic_auth_helper.rb,
lib/capybara/basic_auth_helper/version.rb

Constant Summary collapse

VERSION =
"0.0.1"

Instance Method Summary collapse

Instance Method Details

#basic_auth(name, password) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/capybara/basic_auth_helper.rb', line 7

def basic_auth(name, password)
  if page.driver.respond_to?(:basic_auth)
    page.driver.basic_auth(name, password)
  elsif page.driver.respond_to?(:basic_authorize)
    page.driver.basic_authorize(name, password)
  elsif page.driver.respond_to?(:browser) && page.driver.browser.respond_to?(:basic_authorize)
    page.driver.browser.basic_authorize(name, password)
  else
    raise "I don't know how to log in!"
  end
end