Class: Selenium::DevTools::V149::Overlay

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

Constant Summary collapse

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

Instance Method Summary collapse

Constructor Details

#initialize(devtools) ⇒ Overlay

Returns a new instance of Overlay.



34
35
36
# File 'lib/selenium/devtools/v149/overlay.rb', line 34

def initialize(devtools)
  @devtools = devtools
end

Instance Method Details

#disableObject



43
44
45
# File 'lib/selenium/devtools/v149/overlay.rb', line 43

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

#enableObject



47
48
49
# File 'lib/selenium/devtools/v149/overlay.rb', line 47

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

#get_grid_highlight_objects_for_test(node_ids:) ⇒ Object



60
61
62
63
# File 'lib/selenium/devtools/v149/overlay.rb', line 60

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



51
52
53
54
55
56
57
58
# File 'lib/selenium/devtools/v149/overlay.rb', line 51

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



65
66
67
68
# File 'lib/selenium/devtools/v149/overlay.rb', line 65

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

#hide_highlightObject



70
71
72
# File 'lib/selenium/devtools/v149/overlay.rb', line 70

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

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



74
75
76
77
78
79
# File 'lib/selenium/devtools/v149/overlay.rb', line 74

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



81
82
83
84
85
86
87
88
# File 'lib/selenium/devtools/v149/overlay.rb', line 81

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



90
91
92
93
94
95
# File 'lib/selenium/devtools/v149/overlay.rb', line 90

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



97
98
99
100
101
102
103
104
105
# File 'lib/selenium/devtools/v149/overlay.rb', line 97

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



107
108
109
110
111
112
113
# File 'lib/selenium/devtools/v149/overlay.rb', line 107

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



38
39
40
41
# File 'lib/selenium/devtools/v149/overlay.rb', line 38

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



115
116
117
118
119
# File 'lib/selenium/devtools/v149/overlay.rb', line 115

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



126
127
128
129
# File 'lib/selenium/devtools/v149/overlay.rb', line 126

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

#set_show_ad_highlights(show:) ⇒ Object



121
122
123
124
# File 'lib/selenium/devtools/v149/overlay.rb', line 121

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

#set_show_container_query_overlays(container_query_highlight_configs:) ⇒ Object



156
157
158
159
# File 'lib/selenium/devtools/v149/overlay.rb', line 156

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



131
132
133
134
# File 'lib/selenium/devtools/v149/overlay.rb', line 131

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

#set_show_flex_overlays(flex_node_highlight_configs:) ⇒ Object



146
147
148
149
# File 'lib/selenium/devtools/v149/overlay.rb', line 146

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



136
137
138
139
# File 'lib/selenium/devtools/v149/overlay.rb', line 136

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

#set_show_grid_overlays(grid_node_highlight_configs:) ⇒ Object



141
142
143
144
# File 'lib/selenium/devtools/v149/overlay.rb', line 141

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



196
197
198
199
# File 'lib/selenium/devtools/v149/overlay.rb', line 196

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

#set_show_hit_test_borders(show:) ⇒ Object



181
182
183
184
# File 'lib/selenium/devtools/v149/overlay.rb', line 181

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

#set_show_inspected_element_anchor(inspected_element_anchor_config:) ⇒ Object



161
162
163
164
# File 'lib/selenium/devtools/v149/overlay.rb', line 161

def set_show_inspected_element_anchor(inspected_element_anchor_config:)
  @devtools.send_cmd('Overlay.setShowInspectedElementAnchor',
                     inspectedElementAnchorConfig: inspected_element_anchor_config)
end

#set_show_isolated_elements(isolated_element_highlight_configs:) ⇒ Object



201
202
203
204
# File 'lib/selenium/devtools/v149/overlay.rb', line 201

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



171
172
173
174
# File 'lib/selenium/devtools/v149/overlay.rb', line 171

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

#set_show_paint_rects(result:) ⇒ Object



166
167
168
169
# File 'lib/selenium/devtools/v149/overlay.rb', line 166

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

#set_show_scroll_bottleneck_rects(show:) ⇒ Object



176
177
178
179
# File 'lib/selenium/devtools/v149/overlay.rb', line 176

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



151
152
153
154
# File 'lib/selenium/devtools/v149/overlay.rb', line 151

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



191
192
193
194
# File 'lib/selenium/devtools/v149/overlay.rb', line 191

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

#set_show_web_vitals(show:) ⇒ Object



186
187
188
189
# File 'lib/selenium/devtools/v149/overlay.rb', line 186

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

#set_show_window_controls_overlay(window_controls_overlay_config: nil) ⇒ Object



206
207
208
209
# File 'lib/selenium/devtools/v149/overlay.rb', line 206

def set_show_window_controls_overlay(window_controls_overlay_config: nil)
  @devtools.send_cmd('Overlay.setShowWindowControlsOverlay',
                     windowControlsOverlayConfig: window_controls_overlay_config)
end