Class: Selenium::DevTools::V148::WebMCP

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

Constant Summary collapse

EVENTS =
{
  tools_added: 'toolsAdded',
  tools_removed: 'toolsRemoved',
  tool_invoked: 'toolInvoked',
  tool_responded: 'toolResponded',
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(devtools) ⇒ WebMCP

Returns a new instance of WebMCP.



32
33
34
# File 'lib/selenium/devtools/v148/web_mcp.rb', line 32

def initialize(devtools)
  @devtools = devtools
end

Instance Method Details

#disableObject



45
46
47
# File 'lib/selenium/devtools/v148/web_mcp.rb', line 45

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

#enableObject



41
42
43
# File 'lib/selenium/devtools/v148/web_mcp.rb', line 41

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

#on(event, &block) ⇒ Object



36
37
38
39
# File 'lib/selenium/devtools/v148/web_mcp.rb', line 36

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