Class: Selenium::DevTools::V150::Performance

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

Constant Summary collapse

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

Instance Method Summary collapse

Constructor Details

#initialize(devtools) ⇒ Performance

Returns a new instance of Performance.



30
31
32
# File 'lib/selenium/devtools/v150/performance.rb', line 30

def initialize(devtools)
  @devtools = devtools
end

Instance Method Details

#disableObject



39
40
41
# File 'lib/selenium/devtools/v150/performance.rb', line 39

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

#enable(time_domain: nil) ⇒ Object



43
44
45
46
# File 'lib/selenium/devtools/v150/performance.rb', line 43

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

#get_metricsObject



53
54
55
# File 'lib/selenium/devtools/v150/performance.rb', line 53

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

#on(event, &block) ⇒ Object



34
35
36
37
# File 'lib/selenium/devtools/v150/performance.rb', line 34

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

#set_time_domain(time_domain:) ⇒ Object



48
49
50
51
# File 'lib/selenium/devtools/v150/performance.rb', line 48

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