Class: Selenium::DevTools::V116::Preload

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

Constant Summary collapse

EVENTS =
{
  rule_set_updated: 'ruleSetUpdated',
  rule_set_removed: 'ruleSetRemoved',
  prerender_attempt_completed: 'prerenderAttemptCompleted',
  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.



35
36
37
# File 'lib/selenium/devtools/v116/preload.rb', line 35

def initialize(devtools)
  @devtools = devtools
end

Instance Method Details

#disableObject



48
49
50
# File 'lib/selenium/devtools/v116/preload.rb', line 48

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

#enableObject



44
45
46
# File 'lib/selenium/devtools/v116/preload.rb', line 44

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

#on(event, &block) ⇒ Object



39
40
41
42
# File 'lib/selenium/devtools/v116/preload.rb', line 39

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