Class: Selenium::DevTools::V115::Overlay

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/devtools/v115/overlay.rb

Constant Summary collapse

EVENTS =
{
  inspect_node_requested: 'inspectNodeRequested',
  node_highlight_requested: 'nodeHighlightRequested',
  screenshot_requested: 'screenshotRequested',
  inspect_mode_canceled: 'inspectModeCanceled',
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(devtools) ⇒ Overlay

Returns a new instance of Overlay.



32
33
34
# File 'lib/selenium/devtools/v115/overlay.rb', line 32

def initialize(devtools)
  @devtools = devtools
end

Instance Method Details

#disableObject



41
42
43
# File 'lib/selenium/devtools/v115/overlay.rb', line 41

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

#enableObject



45
46
47
# File 'lib/selenium/devtools/v115/overlay.rb', line 45

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

#get_grid_highlight_objects_for_test(node_ids:) ⇒ Object



58
59
60
61
# File 'lib/selenium/devtools/v115/overlay.rb', line 58

def get_grid_highlight_objects_for_test(node_ids:)
  @devtools.send_cmd('Overlay.getGridHighlightObjectsForTest',
                     nodeIds: node_ids)
end

#get_highlight_object_for_test(node_id:, include_distance: nil, include_style: nil, color_format: nil, show_accessibility_info: nil) ⇒ Object



49
50
51
52
53
54
55
56
# File 'lib/selenium/devtools/v115/overlay.rb', line 49

def get_highlight_object_for_test(node_id:, include_distance: nil, include_style: nil, color_format: nil, show_accessibility_info: nil)
  @devtools.send_cmd('Overlay.getHighlightObjectForTest',
                     nodeId: node_id,
                     includeDistance: include_distance,
                     includeStyle: include_style,
                     colorFormat: color_format,
                     showAccessibilityInfo: show_accessibility_info)
end

#get_source_order_highlight_object_for_test(node_id:) ⇒ Object



63
64
65
66
# File 'lib/selenium/devtools/v115/overlay.rb', line 63

def get_source_order_highlight_object_for_test(node_id:)
  @devtools.send_cmd('Overlay.getSourceOrderHighlightObjectForTest',
                     nodeId: node_id)
end

#hide_highlightObject



68
69
70
# File 'lib/selenium/devtools/v115/overlay.rb', line 68

def hide_highlight
  @devtools.send_cmd('Overlay.hideHighlight')
end

#highlight_frame(frame_id:, content_color: nil, content_outline_color: nil) ⇒ Object



72
73
74
75
76
77
# File 'lib/selenium/devtools/v115/overlay.rb', line 72

def highlight_frame(frame_id:, content_color: nil, content_outline_color: nil)
  @devtools.send_cmd('Overlay.highlightFrame',
                     frameId: frame_id,
                     contentColor: content_color,
                     contentOutlineColor: content_outline_color)
end

#highlight_node(highlight_config:, node_id: nil, backend_node_id: nil, object_id: nil, selector: nil) ⇒ Object



79
80
81
82
83
84
85
86
# File 'lib/selenium/devtools/v115/overlay.rb', line 79

def highlight_node(highlight_config:, node_id: nil, backend_node_id: nil, object_id: nil, selector: nil)
  @devtools.send_cmd('Overlay.highlightNode',
                     highlightConfig: highlight_config,
                     nodeId: node_id,
                     backendNodeId: backend_node_id,
                     objectId: object_id,
                     selector: selector)
end

#highlight_quad(quad:, color: nil, outline_color: nil) ⇒ Object



88
89
90
91
92
93
# File 'lib/selenium/devtools/v115/overlay.rb', line 88

def highlight_quad(quad:, color: nil, outline_color: nil)
  @devtools.send_cmd('Overlay.highlightQuad',
                     quad: quad,
                     color: color,
                     outlineColor: outline_color)
end

#highlight_rect(x:, y:, width:, height:, color: nil, outline_color: nil) ⇒ Object



95
96
97
98
99
100
101
102
103
# File 'lib/selenium/devtools/v115/overlay.rb', line 95

def highlight_rect(x:, y:, width:, height:, color: nil, outline_color: nil)
  @devtools.send_cmd('Overlay.highlightRect',
                     x: x,
                     y: y,
                     width: width,
                     height: height,
                     color: color,
                     outlineColor: outline_color)
end

#highlight_source_order(source_order_config:, node_id: nil, backend_node_id: nil, object_id: nil) ⇒ Object



105
106
107
108
109
110
111
# File 'lib/selenium/devtools/v115/overlay.rb', line 105

def highlight_source_order(source_order_config:, node_id: nil, backend_node_id: nil, object_id: nil)
  @devtools.send_cmd('Overlay.highlightSourceOrder',
                     sourceOrderConfig: source_order_config,
                     nodeId: node_id,
                     backendNodeId: backend_node_id,
                     objectId: object_id)
end

#on(event, &block) ⇒ Object



36
37
38
39
# File 'lib/selenium/devtools/v115/overlay.rb', line 36

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

#set_inspect_mode(mode:, highlight_config: nil) ⇒ Object



113
114
115
116
117
# File 'lib/selenium/devtools/v115/overlay.rb', line 113

def set_inspect_mode(mode:, highlight_config: nil)
  @devtools.send_cmd('Overlay.setInspectMode',
                     mode: mode,
                     highlightConfig: highlight_config)
end

#set_paused_in_debugger_message(message: nil) ⇒ Object



124
125
126
127
# File 'lib/selenium/devtools/v115/overlay.rb', line 124

def set_paused_in_debugger_message(message: nil)
  @devtools.send_cmd('Overlay.setPausedInDebuggerMessage',
                     message: message)
end

#set_show_ad_highlights(show:) ⇒ Object



119
120
121
122
# File 'lib/selenium/devtools/v115/overlay.rb', line 119

def set_show_ad_highlights(show:)
  @devtools.send_cmd('Overlay.setShowAdHighlights',
                     show: show)
end

#set_show_container_query_overlays(container_query_highlight_configs:) ⇒ Object



154
155
156
157
# File 'lib/selenium/devtools/v115/overlay.rb', line 154

def set_show_container_query_overlays(container_query_highlight_configs:)
  @devtools.send_cmd('Overlay.setShowContainerQueryOverlays',
                     containerQueryHighlightConfigs: container_query_highlight_configs)
end

#set_show_debug_borders(show:) ⇒ Object



129
130
131
132
# File 'lib/selenium/devtools/v115/overlay.rb', line 129

def set_show_debug_borders(show:)
  @devtools.send_cmd('Overlay.setShowDebugBorders',
                     show: show)
end

#set_show_flex_overlays(flex_node_highlight_configs:) ⇒ Object



144
145
146
147
# File 'lib/selenium/devtools/v115/overlay.rb', line 144

def set_show_flex_overlays(flex_node_highlight_configs:)
  @devtools.send_cmd('Overlay.setShowFlexOverlays',
                     flexNodeHighlightConfigs: flex_node_highlight_configs)
end

#set_show_fps_counter(show:) ⇒ Object



134
135
136
137
# File 'lib/selenium/devtools/v115/overlay.rb', line 134

def set_show_fps_counter(show:)
  @devtools.send_cmd('Overlay.setShowFPSCounter',
                     show: show)
end

#set_show_grid_overlays(grid_node_highlight_configs:) ⇒ Object



139
140
141
142
# File 'lib/selenium/devtools/v115/overlay.rb', line 139

def set_show_grid_overlays(grid_node_highlight_configs:)
  @devtools.send_cmd('Overlay.setShowGridOverlays',
                     gridNodeHighlightConfigs: grid_node_highlight_configs)
end

#set_show_hinge(hinge_config: nil) ⇒ Object



189
190
191
192
# File 'lib/selenium/devtools/v115/overlay.rb', line 189

def set_show_hinge(hinge_config: nil)
  @devtools.send_cmd('Overlay.setShowHinge',
                     hingeConfig: hinge_config)
end

#set_show_hit_test_borders(show:) ⇒ Object



174
175
176
177
# File 'lib/selenium/devtools/v115/overlay.rb', line 174

def set_show_hit_test_borders(show:)
  @devtools.send_cmd('Overlay.setShowHitTestBorders',
                     show: show)
end

#set_show_isolated_elements(isolated_element_highlight_configs:) ⇒ Object



194
195
196
197
# File 'lib/selenium/devtools/v115/overlay.rb', line 194

def set_show_isolated_elements(isolated_element_highlight_configs:)
  @devtools.send_cmd('Overlay.setShowIsolatedElements',
                     isolatedElementHighlightConfigs: isolated_element_highlight_configs)
end

#set_show_layout_shift_regions(result:) ⇒ Object



164
165
166
167
# File 'lib/selenium/devtools/v115/overlay.rb', line 164

def set_show_layout_shift_regions(result:)
  @devtools.send_cmd('Overlay.setShowLayoutShiftRegions',
                     result: result)
end

#set_show_paint_rects(result:) ⇒ Object



159
160
161
162
# File 'lib/selenium/devtools/v115/overlay.rb', line 159

def set_show_paint_rects(result:)
  @devtools.send_cmd('Overlay.setShowPaintRects',
                     result: result)
end

#set_show_scroll_bottleneck_rects(show:) ⇒ Object



169
170
171
172
# File 'lib/selenium/devtools/v115/overlay.rb', line 169

def set_show_scroll_bottleneck_rects(show:)
  @devtools.send_cmd('Overlay.setShowScrollBottleneckRects',
                     show: show)
end

#set_show_scroll_snap_overlays(scroll_snap_highlight_configs:) ⇒ Object



149
150
151
152
# File 'lib/selenium/devtools/v115/overlay.rb', line 149

def set_show_scroll_snap_overlays(scroll_snap_highlight_configs:)
  @devtools.send_cmd('Overlay.setShowScrollSnapOverlays',
                     scrollSnapHighlightConfigs: scroll_snap_highlight_configs)
end

#set_show_viewport_size_on_resize(show:) ⇒ Object



184
185
186
187
# File 'lib/selenium/devtools/v115/overlay.rb', line 184

def set_show_viewport_size_on_resize(show:)
  @devtools.send_cmd('Overlay.setShowViewportSizeOnResize',
                     show: show)
end

#set_show_web_vitals(show:) ⇒ Object



179
180
181
182
# File 'lib/selenium/devtools/v115/overlay.rb', line 179

def set_show_web_vitals(show:)
  @devtools.send_cmd('Overlay.setShowWebVitals',
                     show: show)
end