Class: Capybara::Lightpanda::Browser::SeleniumCompat::Logs
- Inherits:
-
Object
- Object
- Capybara::Lightpanda::Browser::SeleniumCompat::Logs
- Defined in:
- lib/capybara/lightpanda/browser/selenium_compat.rb
Overview
Selenium's driver.logs accessor. Only the :browser type has a
meaning here; other Selenium log types (:driver, :client,
:server) have no analogue and read as empty rather than raising, so
a helper that probes several types still works.
Instance Method Summary collapse
- #available_types ⇒ Object
- #get(type = :browser) ⇒ Object
-
#initialize(browser) ⇒ Logs
constructor
A new instance of Logs.
Constructor Details
#initialize(browser) ⇒ Logs
Returns a new instance of Logs.
51 52 53 |
# File 'lib/capybara/lightpanda/browser/selenium_compat.rb', line 51 def initialize(browser) @browser = browser end |
Instance Method Details
#available_types ⇒ Object
67 68 69 |
# File 'lib/capybara/lightpanda/browser/selenium_compat.rb', line 67 def available_types [:browser] end |
#get(type = :browser) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/capybara/lightpanda/browser/selenium_compat.rb', line 55 def get(type = :browser) return [] unless type.to_sym == :browser @browser.console_logs.map do |entry| LogEntry.new( CONSOLE_LEVELS.fetch(entry[:type], "INFO"), entry[:text], entry[:timestamp] ) end end |