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.



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

def initialize(devtools)
  @devtools = devtools
end

Instance Method Details

#disableObject



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

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

#enableObject



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

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

#get_grid_highlight_objects_for_test(node_ids:) ⇒ Object



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

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



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

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



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

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

#hide_highlightObject



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

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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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

#set_show_ad_highlights(show:) ⇒ Object



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

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

#set_show_container_query_overlays(container_query_highlight_configs:) ⇒ Object



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

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



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

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

#set_show_flex_overlays(flex_node_highlight_configs:) ⇒ Object



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

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



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

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

#set_show_grid_overlays(grid_node_highlight_configs:) ⇒ Object



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

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



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

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

#set_show_hit_test_borders(show:) ⇒ Object



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

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



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

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



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

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



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

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

#set_show_paint_rects(result:) ⇒ Object



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

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

#set_show_scroll_bottleneck_rects(show:) ⇒ Object



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

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



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

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



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

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

#set_show_web_vitals(show:) ⇒ Object



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

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



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

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