Class: Selenium::DevTools::V151::LayerTree

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/devtools/v151/layer_tree.rb

Constant Summary collapse

EVENTS =
{
  layer_painted: 'layerPainted',
  layer_tree_did_change: 'layerTreeDidChange',
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(devtools) ⇒ LayerTree

Returns a new instance of LayerTree.



31
32
33
# File 'lib/selenium/devtools/v151/layer_tree.rb', line 31

def initialize(devtools)
  @devtools = devtools
end

Instance Method Details

#compositing_reasons(layer_id:) ⇒ Object



40
41
42
43
# File 'lib/selenium/devtools/v151/layer_tree.rb', line 40

def compositing_reasons(layer_id:)
  @devtools.send_cmd('LayerTree.compositingReasons',
                     layerId: layer_id)
end

#disableObject



45
46
47
# File 'lib/selenium/devtools/v151/layer_tree.rb', line 45

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

#enableObject



49
50
51
# File 'lib/selenium/devtools/v151/layer_tree.rb', line 49

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

#load_snapshot(tiles:) ⇒ Object



53
54
55
56
# File 'lib/selenium/devtools/v151/layer_tree.rb', line 53

def load_snapshot(tiles:)
  @devtools.send_cmd('LayerTree.loadSnapshot',
                     tiles: tiles)
end

#make_snapshot(layer_id:) ⇒ Object



58
59
60
61
# File 'lib/selenium/devtools/v151/layer_tree.rb', line 58

def make_snapshot(layer_id:)
  @devtools.send_cmd('LayerTree.makeSnapshot',
                     layerId: layer_id)
end

#on(event, &block) ⇒ Object



35
36
37
38
# File 'lib/selenium/devtools/v151/layer_tree.rb', line 35

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

#profile_snapshot(snapshot_id:, min_repeat_count: nil, min_duration: nil, clip_rect: nil) ⇒ Object



63
64
65
66
67
68
69
# File 'lib/selenium/devtools/v151/layer_tree.rb', line 63

def profile_snapshot(snapshot_id:, min_repeat_count: nil, min_duration: nil, clip_rect: nil)
  @devtools.send_cmd('LayerTree.profileSnapshot',
                     snapshotId: snapshot_id,
                     minRepeatCount: min_repeat_count,
                     minDuration: min_duration,
                     clipRect: clip_rect)
end

#release_snapshot(snapshot_id:) ⇒ Object



71
72
73
74
# File 'lib/selenium/devtools/v151/layer_tree.rb', line 71

def release_snapshot(snapshot_id:)
  @devtools.send_cmd('LayerTree.releaseSnapshot',
                     snapshotId: snapshot_id)
end

#replay_snapshot(snapshot_id:, from_step: nil, to_step: nil, scale: nil) ⇒ Object



76
77
78
79
80
81
82
# File 'lib/selenium/devtools/v151/layer_tree.rb', line 76

def replay_snapshot(snapshot_id:, from_step: nil, to_step: nil, scale: nil)
  @devtools.send_cmd('LayerTree.replaySnapshot',
                     snapshotId: snapshot_id,
                     fromStep: from_step,
                     toStep: to_step,
                     scale: scale)
end

#snapshot_command_log(snapshot_id:) ⇒ Object



84
85
86
87
# File 'lib/selenium/devtools/v151/layer_tree.rb', line 84

def snapshot_command_log(snapshot_id:)
  @devtools.send_cmd('LayerTree.snapshotCommandLog',
                     snapshotId: snapshot_id)
end