Module: Spreewald::DriverInfo

Included in:
FieldErrorFinder
Defined in:
lib/spreewald_support/driver_info.rb

Instance Method Summary collapse

Instance Method Details

#browserObject



20
21
22
# File 'lib/spreewald_support/driver_info.rb', line 20

def browser
  page.driver.browser if page.driver.respond_to?(:browser)
end

#javascript_capable?Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/spreewald_support/driver_info.rb', line 4

def javascript_capable?
  selenium_driver? || poltergeist_driver? || webkit_driver?
end

#poltergeist_driver?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/spreewald_support/driver_info.rb', line 12

def poltergeist_driver?
  Object.const_defined?('Capybara::Poltergeist') && Capybara.current_session.driver.is_a?(Capybara::Poltergeist::Driver)
end

#require_selenium!Object



24
25
26
# File 'lib/spreewald_support/driver_info.rb', line 24

def require_selenium!
  raise 'This step only works with Selenium' unless selenium_driver?
end

#selenium_driver?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/spreewald_support/driver_info.rb', line 8

def selenium_driver?
  Object.const_defined?('Capybara::Selenium') && Capybara.current_session.driver.is_a?(Capybara::Selenium::Driver)
end

#webkit_driver?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/spreewald_support/driver_info.rb', line 16

def webkit_driver?
  Object.const_defined?('Capybara::Webkit') && Capybara.current_session.driver.is_a?(Capybara::Webkit::Driver)
end