module Capybara::Selenium::ChromeLogs

Constants

COMMANDS
LOG_MSG

Public Instance Methods

available_log_types() click to toggle source
# File lib/capybara/selenium/patches/logs.rb, line 21
def available_log_types
  types = execute :get_available_log_types
  Array(types).map(&:to_sym)
rescue ::Selenium::WebDriver::Error::UnknownCommandError
  raise NotImplementedError, LOG_MSG
end
commands(command) click to toggle source
Calls superclass method
# File lib/capybara/selenium/patches/logs.rb, line 17
def commands(command)
  COMMANDS[command] || super
end
log(type) click to toggle source
# File lib/capybara/selenium/patches/logs.rb, line 28
def log(type)
  data = begin
    execute :get_log, {}, type: type.to_s
  rescue ::Selenium::WebDriver::Error::UnknownCommandError
    execute :get_log_legacy, {}, type: type.to_s
  end

  Array(data).map do |l|
    ::Selenium::WebDriver::LogEntry.new l.fetch('level', 'UNKNOWN'), l.fetch('timestamp'), l.fetch('message')
  rescue KeyError
    next
  end
rescue ::Selenium::WebDriver::Error::UnknownCommandError
  raise NotImplementedError, LOG_MSG
end