Class: Selenium::DevTools::V122::Preload

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/devtools/v122/preload.rb

Constant Summary collapse

EVENTS =
{
  rule_set_updated: 'ruleSetUpdated',
  rule_set_removed: 'ruleSetRemoved',
  preload_enabled_state_updated: 'preloadEnabledStateUpdated',
  prefetch_status_updated: 'prefetchStatusUpdated',
  prerender_status_updated: 'prerenderStatusUpdated',
  preloading_attempt_sources_updated: 'preloadingAttemptSourcesUpdated',
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(devtools) ⇒ Preload

Returns a new instance of Preload.



34
35
36
# File 'lib/selenium/devtools/v122/preload.rb', line 34

def initialize(devtools)
  @devtools = devtools
end

Instance Method Details

#disableObject



47
48
49
# File 'lib/selenium/devtools/v122/preload.rb', line 47

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

#enableObject



43
44
45
# File 'lib/selenium/devtools/v122/preload.rb', line 43

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

#on(event, &block) ⇒ Object



38
39
40
41
# File 'lib/selenium/devtools/v122/preload.rb', line 38

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