Class: Selenium::DevTools::V85::Overlay

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

def initialize(devtools)
  @devtools = devtools
end

Instance Method Details

#disableObject



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

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

#enableObject



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

def enable
  @devtools.send_cmd('Overlay.enable')
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/v85/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

#hide_highlightObject



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

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

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



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

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



69
70
71
72
73
74
75
76
# File 'lib/selenium/devtools/v85/overlay.rb', line 69

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



78
79
80
81
82
83
# File 'lib/selenium/devtools/v85/overlay.rb', line 78

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



85
86
87
88
89
90
91
92
93
# File 'lib/selenium/devtools/v85/overlay.rb', line 85

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

#on(event, &block) ⇒ Object



36
37
38
39
# File 'lib/selenium/devtools/v85/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



95
96
97
98
99
# File 'lib/selenium/devtools/v85/overlay.rb', line 95

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



106
107
108
109
# File 'lib/selenium/devtools/v85/overlay.rb', line 106

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

#set_show_ad_highlights(show:) ⇒ Object



101
102
103
104
# File 'lib/selenium/devtools/v85/overlay.rb', line 101

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

#set_show_debug_borders(show:) ⇒ Object



111
112
113
114
# File 'lib/selenium/devtools/v85/overlay.rb', line 111

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

#set_show_fps_counter(show:) ⇒ Object



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

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

#set_show_hinge(hinge_config: nil) ⇒ Object



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

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

#set_show_hit_test_borders(show:) ⇒ Object



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

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

#set_show_layout_shift_regions(result:) ⇒ Object



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

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

#set_show_paint_rects(result:) ⇒ Object



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

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

#set_show_scroll_bottleneck_rects(show:) ⇒ Object



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

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

#set_show_viewport_size_on_resize(show:) ⇒ Object



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

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