Class: Selenium::DevTools::V85::Tracing

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/devtools/v85/tracing.rb

Constant Summary collapse

EVENTS =
{
  buffer_usage: 'bufferUsage',
  data_collected: 'dataCollected',
  tracing_complete: 'tracingComplete',
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(devtools) ⇒ Tracing

Returns a new instance of Tracing.



31
32
33
# File 'lib/selenium/devtools/v85/tracing.rb', line 31

def initialize(devtools)
  @devtools = devtools
end

Instance Method Details

#_endObject



40
41
42
# File 'lib/selenium/devtools/v85/tracing.rb', line 40

def _end
  @devtools.send_cmd('Tracing.end')
end

#get_categoriesObject



44
45
46
# File 'lib/selenium/devtools/v85/tracing.rb', line 44

def get_categories
  @devtools.send_cmd('Tracing.getCategories')
end

#on(event, &block) ⇒ Object



35
36
37
38
# File 'lib/selenium/devtools/v85/tracing.rb', line 35

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

#record_clock_sync_marker(sync_id:) ⇒ Object



48
49
50
51
# File 'lib/selenium/devtools/v85/tracing.rb', line 48

def record_clock_sync_marker(sync_id:)
  @devtools.send_cmd('Tracing.recordClockSyncMarker',
                     syncId: sync_id)
end

#request_memory_dump(deterministic: nil) ⇒ Object



53
54
55
56
# File 'lib/selenium/devtools/v85/tracing.rb', line 53

def request_memory_dump(deterministic: nil)
  @devtools.send_cmd('Tracing.requestMemoryDump',
                     deterministic: deterministic)
end

#start(categories: nil, options: nil, buffer_usage_reporting_interval: nil, transfer_mode: nil, stream_format: nil, stream_compression: nil, trace_config: nil) ⇒ Object



58
59
60
61
62
63
64
65
66
67
# File 'lib/selenium/devtools/v85/tracing.rb', line 58

def start(categories: nil, options: nil, buffer_usage_reporting_interval: nil, transfer_mode: nil, stream_format: nil, stream_compression: nil, trace_config: nil)
  @devtools.send_cmd('Tracing.start',
                     categories: categories,
                     options: options,
                     bufferUsageReportingInterval: buffer_usage_reporting_interval,
                     transferMode: transfer_mode,
                     streamFormat: stream_format,
                     streamCompression: stream_compression,
                     traceConfig: trace_config)
end