Class: Selenium::DevTools::V129::Performance

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/devtools/v129/performance.rb

Constant Summary collapse

EVENTS =
{
  metrics: 'metrics',
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(devtools) ⇒ Performance

Returns a new instance of Performance.



29
30
31
# File 'lib/selenium/devtools/v129/performance.rb', line 29

def initialize(devtools)
  @devtools = devtools
end

Instance Method Details

#disableObject



38
39
40
# File 'lib/selenium/devtools/v129/performance.rb', line 38

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

#enable(time_domain: nil) ⇒ Object



42
43
44
45
# File 'lib/selenium/devtools/v129/performance.rb', line 42

def enable(time_domain: nil)
  @devtools.send_cmd('Performance.enable',
                     timeDomain: time_domain)
end

#get_metricsObject



52
53
54
# File 'lib/selenium/devtools/v129/performance.rb', line 52

def get_metrics
  @devtools.send_cmd('Performance.getMetrics')
end

#on(event, &block) ⇒ Object



33
34
35
36
# File 'lib/selenium/devtools/v129/performance.rb', line 33

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

#set_time_domain(time_domain:) ⇒ Object



47
48
49
50
# File 'lib/selenium/devtools/v129/performance.rb', line 47

def set_time_domain(time_domain:)
  @devtools.send_cmd('Performance.setTimeDomain',
                     timeDomain: time_domain)
end