Module: Capybara::Lockstep::PageAccess

Included in:
Capybara::Lockstep, Client
Defined in:
lib/capybara-lockstep/page_access.rb

Instance Method Summary collapse

Instance Method Details

#alert_present?Boolean

Returns:

  • (Boolean)


14
15
16
17
18
19
20
21
22
23
24
# File 'lib/capybara-lockstep/page_access.rb', line 14

def alert_present?
  # Chrome 54 and/or Chromedriver 2.24 introduced a breaking change on how
  # accessing browser logs work.
  #
  # Apparently, while an alert/confirm is open, Chrome will block any requests
  # to its `getLog` API. This causes Selenium to time out with a `Net::ReadTimeout` error
  page.driver.browser.switch_to.alert
  true
rescue Capybara::NotSupportedByDriverError, ::Selenium::WebDriver::Error::NoSuchAlertError, ::Selenium::WebDriver::Error::NoSuchWindowError
  false
end

#javascript_driver?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/capybara-lockstep/page_access.rb', line 10

def javascript_driver?
  driver.is_a?(Capybara::Selenium::Driver)
end

#pageObject



4
5
6
# File 'lib/capybara-lockstep/page_access.rb', line 4

def page
  Capybara.current_session
end