Class: Selenium::DevTools::V129::Tracing

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/devtools/v129/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/v129/tracing.rb', line 31

def initialize(devtools)
  @devtools = devtools
end

Instance Method Details

#_endObject



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

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

#get_categoriesObject



44
45
46
# File 'lib/selenium/devtools/v129/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/v129/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/v129/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, level_of_detail: nil) ⇒ Object



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

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

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



59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/selenium/devtools/v129/tracing.rb', line 59

def start(categories: nil, options: nil, buffer_usage_reporting_interval: nil, transfer_mode: nil, stream_format: nil, stream_compression: nil, trace_config: nil, perfetto_config: nil, tracing_backend: 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,
                     perfettoConfig: perfetto_config,
                     tracingBackend: tracing_backend)
end