Class: Selenium::DevTools::V85::Database

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/devtools/v85/database.rb

Constant Summary collapse

EVENTS =
{
  add_database: 'addDatabase',
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(devtools) ⇒ Database

Returns a new instance of Database.



29
30
31
# File 'lib/selenium/devtools/v85/database.rb', line 29

def initialize(devtools)
  @devtools = devtools
end

Instance Method Details

#disableObject



38
39
40
# File 'lib/selenium/devtools/v85/database.rb', line 38

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

#enableObject



42
43
44
# File 'lib/selenium/devtools/v85/database.rb', line 42

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

#execute_sql(database_id:, query:) ⇒ Object



46
47
48
49
50
# File 'lib/selenium/devtools/v85/database.rb', line 46

def execute_sql(database_id:, query:)
  @devtools.send_cmd('Database.executeSQL',
                     databaseId: database_id,
                     query: query)
end

#get_database_table_names(database_id:) ⇒ Object



52
53
54
55
# File 'lib/selenium/devtools/v85/database.rb', line 52

def get_database_table_names(database_id:)
  @devtools.send_cmd('Database.getDatabaseTableNames',
                     databaseId: database_id)
end

#on(event, &block) ⇒ Object



33
34
35
36
# File 'lib/selenium/devtools/v85/database.rb', line 33

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