Class: Selenium::DevTools::V147::WebMCP

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/devtools/v147/web_mcp.rb

Constant Summary collapse

EVENTS =
{
  tools_added: 'toolsAdded',
  tools_removed: 'toolsRemoved',
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(devtools) ⇒ WebMCP

Returns a new instance of WebMCP.



30
31
32
# File 'lib/selenium/devtools/v147/web_mcp.rb', line 30

def initialize(devtools)
  @devtools = devtools
end

Instance Method Details

#enableObject



39
40
41
# File 'lib/selenium/devtools/v147/web_mcp.rb', line 39

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

#on(event, &block) ⇒ Object



34
35
36
37
# File 'lib/selenium/devtools/v147/web_mcp.rb', line 34

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