Class: Selenium::DevTools::V131::Console

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/devtools/v131/console.rb

Constant Summary collapse

EVENTS =
{
  message_added: 'messageAdded',
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(devtools) ⇒ Console

Returns a new instance of Console.



29
30
31
# File 'lib/selenium/devtools/v131/console.rb', line 29

def initialize(devtools)
  @devtools = devtools
end

Instance Method Details

#clear_messagesObject



38
39
40
# File 'lib/selenium/devtools/v131/console.rb', line 38

def clear_messages
  @devtools.send_cmd('Console.clearMessages')
end

#disableObject



42
43
44
# File 'lib/selenium/devtools/v131/console.rb', line 42

def disable
  @devtools.send_cmd('Console.disable')
end

#enableObject



46
47
48
# File 'lib/selenium/devtools/v131/console.rb', line 46

def enable
  @devtools.send_cmd('Console.enable')
end

#on(event, &block) ⇒ Object



33
34
35
36
# File 'lib/selenium/devtools/v131/console.rb', line 33

def on(event, &block)
  event = EVENTS[event] if event.is_a?(Symbol)
  @devtools.callbacks["Console.#{event}"] << block
end