Class: Selenium::DevTools::V123::Profiler

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/devtools/v123/profiler.rb

Constant Summary collapse

EVENTS =
{
  console_profile_finished: 'consoleProfileFinished',
  console_profile_started: 'consoleProfileStarted',
  precise_coverage_delta_update: 'preciseCoverageDeltaUpdate',
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(devtools) ⇒ Profiler

Returns a new instance of Profiler.



31
32
33
# File 'lib/selenium/devtools/v123/profiler.rb', line 31

def initialize(devtools)
  @devtools = devtools
end

Instance Method Details

#disableObject



40
41
42
# File 'lib/selenium/devtools/v123/profiler.rb', line 40

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

#enableObject



44
45
46
# File 'lib/selenium/devtools/v123/profiler.rb', line 44

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

#get_best_effort_coverageObject



48
49
50
# File 'lib/selenium/devtools/v123/profiler.rb', line 48

def get_best_effort_coverage
  @devtools.send_cmd('Profiler.getBestEffortCoverage')
end

#on(event, &block) ⇒ Object



35
36
37
38
# File 'lib/selenium/devtools/v123/profiler.rb', line 35

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

#set_sampling_interval(interval:) ⇒ Object



52
53
54
55
# File 'lib/selenium/devtools/v123/profiler.rb', line 52

def set_sampling_interval(interval:)
  @devtools.send_cmd('Profiler.setSamplingInterval',
                     interval: interval)
end

#startObject



57
58
59
# File 'lib/selenium/devtools/v123/profiler.rb', line 57

def start
  @devtools.send_cmd('Profiler.start')
end

#start_precise_coverage(call_count: nil, detailed: nil, allow_triggered_updates: nil) ⇒ Object



61
62
63
64
65
66
# File 'lib/selenium/devtools/v123/profiler.rb', line 61

def start_precise_coverage(call_count: nil, detailed: nil, allow_triggered_updates: nil)
  @devtools.send_cmd('Profiler.startPreciseCoverage',
                     callCount: call_count,
                     detailed: detailed,
                     allowTriggeredUpdates: allow_triggered_updates)
end

#stopObject



68
69
70
# File 'lib/selenium/devtools/v123/profiler.rb', line 68

def stop
  @devtools.send_cmd('Profiler.stop')
end

#stop_precise_coverageObject



72
73
74
# File 'lib/selenium/devtools/v123/profiler.rb', line 72

def stop_precise_coverage
  @devtools.send_cmd('Profiler.stopPreciseCoverage')
end

#take_precise_coverageObject



76
77
78
# File 'lib/selenium/devtools/v123/profiler.rb', line 76

def take_precise_coverage
  @devtools.send_cmd('Profiler.takePreciseCoverage')
end