Class: Selenium::DevTools::V149::Profiler

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/devtools/v149/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.



32
33
34
# File 'lib/selenium/devtools/v149/profiler.rb', line 32

def initialize(devtools)
  @devtools = devtools
end

Instance Method Details

#disableObject



41
42
43
# File 'lib/selenium/devtools/v149/profiler.rb', line 41

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

#enableObject



45
46
47
# File 'lib/selenium/devtools/v149/profiler.rb', line 45

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

#get_best_effort_coverageObject



49
50
51
# File 'lib/selenium/devtools/v149/profiler.rb', line 49

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

#on(event, &block) ⇒ Object



36
37
38
39
# File 'lib/selenium/devtools/v149/profiler.rb', line 36

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

#set_sampling_interval(interval:) ⇒ Object



53
54
55
56
# File 'lib/selenium/devtools/v149/profiler.rb', line 53

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

#startObject



58
59
60
# File 'lib/selenium/devtools/v149/profiler.rb', line 58

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

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



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

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



69
70
71
# File 'lib/selenium/devtools/v149/profiler.rb', line 69

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

#stop_precise_coverageObject



73
74
75
# File 'lib/selenium/devtools/v149/profiler.rb', line 73

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

#take_precise_coverageObject



77
78
79
# File 'lib/selenium/devtools/v149/profiler.rb', line 77

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