Class: Selenium::WebDriver::Script

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/webdriver/common/script.rb

Instance Method Summary collapse

Constructor Details

#initialize(bridge) ⇒ Script

Returns a new instance of Script.



23
24
25
# File 'lib/selenium/webdriver/common/script.rb', line 23

def initialize(bridge)
  @log_handler = BiDi::LogHandler.new(bridge.bidi)
end

Instance Method Details

#add_console_message_handlerint

Returns id of the handler.

Returns:

  • (int)

    id of the handler



28
29
30
# File 'lib/selenium/webdriver/common/script.rb', line 28

def add_console_message_handler(&)
  @log_handler.add_message_handler('console', &)
end

#add_javascript_error_handlerint

Returns id of the handler.

Returns:

  • (int)

    id of the handler



33
34
35
# File 'lib/selenium/webdriver/common/script.rb', line 33

def add_javascript_error_handler(&)
  @log_handler.add_message_handler('javascript', &)
end

#remove_console_message_handler(id) ⇒ Object Also known as: remove_javascript_error_handler

Parameters:

  • id (int)

    of the handler previously added



38
39
40
# File 'lib/selenium/webdriver/common/script.rb', line 38

def remove_console_message_handler(id)
  @log_handler.remove_message_handler(id)
end