Class: Selenium::DevTools::V131::DOM
- Inherits:
-
Object
- Object
- Selenium::DevTools::V131::DOM
- Defined in:
- lib/selenium/devtools/v131/dom.rb
Constant Summary collapse
- EVENTS =
{ attribute_modified: 'attributeModified', attribute_removed: 'attributeRemoved', character_data_modified: 'characterDataModified', child_node_count_updated: 'childNodeCountUpdated', child_node_inserted: 'childNodeInserted', child_node_removed: 'childNodeRemoved', distributed_nodes_updated: 'distributedNodesUpdated', document_updated: 'documentUpdated', inline_style_invalidated: 'inlineStyleInvalidated', pseudo_element_added: 'pseudoElementAdded', top_layer_elements_updated: 'topLayerElementsUpdated', scrollable_flag_updated: 'scrollableFlagUpdated', pseudo_element_removed: 'pseudoElementRemoved', set_child_nodes: 'setChildNodes', shadow_root_popped: 'shadowRootPopped', shadow_root_pushed: 'shadowRootPushed', }.freeze
Instance Method Summary collapse
- #collect_class_names_from_subtree(node_id:) ⇒ Object
- #copy_to(node_id:, target_node_id:, insert_before_node_id: nil) ⇒ Object
- #describe_node(node_id: nil, backend_node_id: nil, object_id: nil, depth: nil, pierce: nil) ⇒ Object
- #disable ⇒ Object
- #discard_search_results(search_id:) ⇒ Object
- #enable(include_whitespace: nil) ⇒ Object
- #focus(node_id: nil, backend_node_id: nil, object_id: nil) ⇒ Object
- #get_anchor_element(node_id:, anchor_specifier: nil) ⇒ Object
- #get_attributes(node_id:) ⇒ Object
- #get_box_model(node_id: nil, backend_node_id: nil, object_id: nil) ⇒ Object
- #get_container_for_node(node_id:, container_name: nil, physical_axes: nil, logical_axes: nil) ⇒ Object
- #get_content_quads(node_id: nil, backend_node_id: nil, object_id: nil) ⇒ Object
- #get_detached_dom_nodes ⇒ Object
- #get_document(depth: nil, pierce: nil) ⇒ Object
- #get_element_by_relation(node_id:, relation:) ⇒ Object
- #get_file_info(object_id:) ⇒ Object
- #get_flattened_document(depth: nil, pierce: nil) ⇒ Object
- #get_frame_owner(frame_id:) ⇒ Object
- #get_node_for_location(x:, y:, include_user_agent_shadow_dom: nil, ignore_pointer_events_none: nil) ⇒ Object
- #get_node_stack_traces(node_id:) ⇒ Object
- #get_nodes_for_subtree_by_style(node_id:, computed_styles:, pierce: nil) ⇒ Object
- #get_outer_html(node_id: nil, backend_node_id: nil, object_id: nil) ⇒ Object
- #get_querying_descendants_for_container(node_id:) ⇒ Object
- #get_relayout_boundary(node_id:) ⇒ Object
- #get_search_results(search_id:, from_index:, to_index:) ⇒ Object
- #get_top_layer_elements ⇒ Object
- #hide_highlight ⇒ Object
- #highlight_node ⇒ Object
- #highlight_rect ⇒ Object
-
#initialize(devtools) ⇒ DOM
constructor
A new instance of DOM.
- #mark_undoable_state ⇒ Object
- #move_to(node_id:, target_node_id:, insert_before_node_id: nil) ⇒ Object
- #on(event, &block) ⇒ Object
- #perform_search(query:, include_user_agent_shadow_dom: nil) ⇒ Object
- #push_node_by_path_to_frontend(path:) ⇒ Object
- #push_nodes_by_backend_ids_to_frontend(backend_node_ids:) ⇒ Object
- #query_selector(node_id:, selector:) ⇒ Object
- #query_selector_all(node_id:, selector:) ⇒ Object
- #redo ⇒ Object
- #remove_attribute(node_id:, name:) ⇒ Object
- #remove_node(node_id:) ⇒ Object
- #request_child_nodes(node_id:, depth: nil, pierce: nil) ⇒ Object
- #request_node(object_id:) ⇒ Object
- #resolve_node(node_id: nil, backend_node_id: nil, object_group: nil, execution_context_id: nil) ⇒ Object
- #scroll_into_view_if_needed(node_id: nil, backend_node_id: nil, object_id: nil, rect: nil) ⇒ Object
- #set_attribute_value(node_id:, name:, value:) ⇒ Object
- #set_attributes_as_text(node_id:, text:, name: nil) ⇒ Object
- #set_file_input_files(files:, node_id: nil, backend_node_id: nil, object_id: nil) ⇒ Object
- #set_inspected_node(node_id:) ⇒ Object
- #set_node_name(node_id:, name:) ⇒ Object
- #set_node_stack_traces_enabled(enable:) ⇒ Object
- #set_node_value(node_id:, value:) ⇒ Object
- #set_outer_html(node_id:, outer_html:) ⇒ Object
- #undo ⇒ Object
Constructor Details
#initialize(devtools) ⇒ DOM
Returns a new instance of DOM.
44 45 46 |
# File 'lib/selenium/devtools/v131/dom.rb', line 44 def initialize(devtools) @devtools = devtools end |
Instance Method Details
#collect_class_names_from_subtree(node_id:) ⇒ Object
53 54 55 56 |
# File 'lib/selenium/devtools/v131/dom.rb', line 53 def collect_class_names_from_subtree(node_id:) @devtools.send_cmd('DOM.collectClassNamesFromSubtree', nodeId: node_id) end |
#copy_to(node_id:, target_node_id:, insert_before_node_id: nil) ⇒ Object
58 59 60 61 62 63 |
# File 'lib/selenium/devtools/v131/dom.rb', line 58 def copy_to(node_id:, target_node_id:, insert_before_node_id: nil) @devtools.send_cmd('DOM.copyTo', nodeId: node_id, targetNodeId: target_node_id, insertBeforeNodeId: insert_before_node_id) end |
#describe_node(node_id: nil, backend_node_id: nil, object_id: nil, depth: nil, pierce: nil) ⇒ Object
65 66 67 68 69 70 71 72 |
# File 'lib/selenium/devtools/v131/dom.rb', line 65 def describe_node(node_id: nil, backend_node_id: nil, object_id: nil, depth: nil, pierce: nil) @devtools.send_cmd('DOM.describeNode', nodeId: node_id, backendNodeId: backend_node_id, objectId: object_id, depth: depth, pierce: pierce) end |
#disable ⇒ Object
82 83 84 |
# File 'lib/selenium/devtools/v131/dom.rb', line 82 def disable @devtools.send_cmd('DOM.disable') end |
#discard_search_results(search_id:) ⇒ Object
86 87 88 89 |
# File 'lib/selenium/devtools/v131/dom.rb', line 86 def discard_search_results(search_id:) @devtools.send_cmd('DOM.discardSearchResults', searchId: search_id) end |
#enable(include_whitespace: nil) ⇒ Object
91 92 93 94 |
# File 'lib/selenium/devtools/v131/dom.rb', line 91 def enable(include_whitespace: nil) @devtools.send_cmd('DOM.enable', includeWhitespace: include_whitespace) end |
#focus(node_id: nil, backend_node_id: nil, object_id: nil) ⇒ Object
96 97 98 99 100 101 |
# File 'lib/selenium/devtools/v131/dom.rb', line 96 def focus(node_id: nil, backend_node_id: nil, object_id: nil) @devtools.send_cmd('DOM.focus', nodeId: node_id, backendNodeId: backend_node_id, objectId: object_id) end |
#get_anchor_element(node_id:, anchor_specifier: nil) ⇒ Object
350 351 352 353 354 |
# File 'lib/selenium/devtools/v131/dom.rb', line 350 def get_anchor_element(node_id:, anchor_specifier: nil) @devtools.send_cmd('DOM.getAnchorElement', nodeId: node_id, anchorSpecifier: anchor_specifier) end |
#get_attributes(node_id:) ⇒ Object
103 104 105 106 |
# File 'lib/selenium/devtools/v131/dom.rb', line 103 def get_attributes(node_id:) @devtools.send_cmd('DOM.getAttributes', nodeId: node_id) end |
#get_box_model(node_id: nil, backend_node_id: nil, object_id: nil) ⇒ Object
108 109 110 111 112 113 |
# File 'lib/selenium/devtools/v131/dom.rb', line 108 def get_box_model(node_id: nil, backend_node_id: nil, object_id: nil) @devtools.send_cmd('DOM.getBoxModel', nodeId: node_id, backendNodeId: backend_node_id, objectId: object_id) end |
#get_container_for_node(node_id:, container_name: nil, physical_axes: nil, logical_axes: nil) ⇒ Object
337 338 339 340 341 342 343 |
# File 'lib/selenium/devtools/v131/dom.rb', line 337 def get_container_for_node(node_id:, container_name: nil, physical_axes: nil, logical_axes: nil) @devtools.send_cmd('DOM.getContainerForNode', nodeId: node_id, containerName: container_name, physicalAxes: physical_axes, logicalAxes: logical_axes) end |
#get_content_quads(node_id: nil, backend_node_id: nil, object_id: nil) ⇒ Object
115 116 117 118 119 120 |
# File 'lib/selenium/devtools/v131/dom.rb', line 115 def get_content_quads(node_id: nil, backend_node_id: nil, object_id: nil) @devtools.send_cmd('DOM.getContentQuads', nodeId: node_id, backendNodeId: backend_node_id, objectId: object_id) end |
#get_detached_dom_nodes ⇒ Object
301 302 303 |
# File 'lib/selenium/devtools/v131/dom.rb', line 301 def get_detached_dom_nodes @devtools.send_cmd('DOM.getDetachedDomNodes') end |
#get_document(depth: nil, pierce: nil) ⇒ Object
122 123 124 125 126 |
# File 'lib/selenium/devtools/v131/dom.rb', line 122 def get_document(depth: nil, pierce: nil) @devtools.send_cmd('DOM.getDocument', depth: depth, pierce: pierce) end |
#get_element_by_relation(node_id:, relation:) ⇒ Object
223 224 225 226 227 |
# File 'lib/selenium/devtools/v131/dom.rb', line 223 def get_element_by_relation(node_id:, relation:) @devtools.send_cmd('DOM.getElementByRelation', nodeId: node_id, relation: relation) end |
#get_file_info(object_id:) ⇒ Object
296 297 298 299 |
# File 'lib/selenium/devtools/v131/dom.rb', line 296 def get_file_info(object_id:) @devtools.send_cmd('DOM.getFileInfo', objectId: object_id) end |
#get_flattened_document(depth: nil, pierce: nil) ⇒ Object
128 129 130 131 132 |
# File 'lib/selenium/devtools/v131/dom.rb', line 128 def get_flattened_document(depth: nil, pierce: nil) @devtools.send_cmd('DOM.getFlattenedDocument', depth: depth, pierce: pierce) end |
#get_frame_owner(frame_id:) ⇒ Object
332 333 334 335 |
# File 'lib/selenium/devtools/v131/dom.rb', line 332 def get_frame_owner(frame_id:) @devtools.send_cmd('DOM.getFrameOwner', frameId: frame_id) end |
#get_node_for_location(x:, y:, include_user_agent_shadow_dom: nil, ignore_pointer_events_none: nil) ⇒ Object
141 142 143 144 145 146 147 |
# File 'lib/selenium/devtools/v131/dom.rb', line 141 def get_node_for_location(x:, y:, include_user_agent_shadow_dom: nil, ignore_pointer_events_none: nil) @devtools.send_cmd('DOM.getNodeForLocation', x: x, y: y, includeUserAgentShadowDOM: include_user_agent_shadow_dom, ignorePointerEventsNone: ignore_pointer_events_none) end |
#get_node_stack_traces(node_id:) ⇒ Object
291 292 293 294 |
# File 'lib/selenium/devtools/v131/dom.rb', line 291 def get_node_stack_traces(node_id:) @devtools.send_cmd('DOM.getNodeStackTraces', nodeId: node_id) end |
#get_nodes_for_subtree_by_style(node_id:, computed_styles:, pierce: nil) ⇒ Object
134 135 136 137 138 139 |
# File 'lib/selenium/devtools/v131/dom.rb', line 134 def get_nodes_for_subtree_by_style(node_id:, computed_styles:, pierce: nil) @devtools.send_cmd('DOM.getNodesForSubtreeByStyle', nodeId: node_id, computedStyles: computed_styles, pierce: pierce) end |
#get_outer_html(node_id: nil, backend_node_id: nil, object_id: nil) ⇒ Object
149 150 151 152 153 154 |
# File 'lib/selenium/devtools/v131/dom.rb', line 149 def get_outer_html(node_id: nil, backend_node_id: nil, object_id: nil) @devtools.send_cmd('DOM.getOuterHTML', nodeId: node_id, backendNodeId: backend_node_id, objectId: object_id) end |
#get_querying_descendants_for_container(node_id:) ⇒ Object
345 346 347 348 |
# File 'lib/selenium/devtools/v131/dom.rb', line 345 def (node_id:) @devtools.send_cmd('DOM.getQueryingDescendantsForContainer', nodeId: node_id) end |
#get_relayout_boundary(node_id:) ⇒ Object
156 157 158 159 |
# File 'lib/selenium/devtools/v131/dom.rb', line 156 def get_relayout_boundary(node_id:) @devtools.send_cmd('DOM.getRelayoutBoundary', nodeId: node_id) end |
#get_search_results(search_id:, from_index:, to_index:) ⇒ Object
161 162 163 164 165 166 |
# File 'lib/selenium/devtools/v131/dom.rb', line 161 def get_search_results(search_id:, from_index:, to_index:) @devtools.send_cmd('DOM.getSearchResults', searchId: search_id, fromIndex: from_index, toIndex: to_index) end |
#get_top_layer_elements ⇒ Object
219 220 221 |
# File 'lib/selenium/devtools/v131/dom.rb', line 219 def get_top_layer_elements @devtools.send_cmd('DOM.getTopLayerElements') end |
#hide_highlight ⇒ Object
168 169 170 |
# File 'lib/selenium/devtools/v131/dom.rb', line 168 def hide_highlight @devtools.send_cmd('DOM.hideHighlight') end |
#highlight_node ⇒ Object
172 173 174 |
# File 'lib/selenium/devtools/v131/dom.rb', line 172 def highlight_node @devtools.send_cmd('DOM.highlightNode') end |
#highlight_rect ⇒ Object
176 177 178 |
# File 'lib/selenium/devtools/v131/dom.rb', line 176 def highlight_rect @devtools.send_cmd('DOM.highlightRect') end |
#mark_undoable_state ⇒ Object
180 181 182 |
# File 'lib/selenium/devtools/v131/dom.rb', line 180 def mark_undoable_state @devtools.send_cmd('DOM.markUndoableState') end |
#move_to(node_id:, target_node_id:, insert_before_node_id: nil) ⇒ Object
184 185 186 187 188 189 |
# File 'lib/selenium/devtools/v131/dom.rb', line 184 def move_to(node_id:, target_node_id:, insert_before_node_id: nil) @devtools.send_cmd('DOM.moveTo', nodeId: node_id, targetNodeId: target_node_id, insertBeforeNodeId: insert_before_node_id) end |
#on(event, &block) ⇒ Object
48 49 50 51 |
# File 'lib/selenium/devtools/v131/dom.rb', line 48 def on(event, &block) event = EVENTS[event] if event.is_a?(Symbol) @devtools.callbacks["DOM.#{event}"] << block end |
#perform_search(query:, include_user_agent_shadow_dom: nil) ⇒ Object
191 192 193 194 195 |
# File 'lib/selenium/devtools/v131/dom.rb', line 191 def perform_search(query:, include_user_agent_shadow_dom: nil) @devtools.send_cmd('DOM.performSearch', query: query, includeUserAgentShadowDOM: include_user_agent_shadow_dom) end |
#push_node_by_path_to_frontend(path:) ⇒ Object
197 198 199 200 |
# File 'lib/selenium/devtools/v131/dom.rb', line 197 def push_node_by_path_to_frontend(path:) @devtools.send_cmd('DOM.pushNodeByPathToFrontend', path: path) end |
#push_nodes_by_backend_ids_to_frontend(backend_node_ids:) ⇒ Object
202 203 204 205 |
# File 'lib/selenium/devtools/v131/dom.rb', line 202 def push_nodes_by_backend_ids_to_frontend(backend_node_ids:) @devtools.send_cmd('DOM.pushNodesByBackendIdsToFrontend', backendNodeIds: backend_node_ids) end |
#query_selector(node_id:, selector:) ⇒ Object
207 208 209 210 211 |
# File 'lib/selenium/devtools/v131/dom.rb', line 207 def query_selector(node_id:, selector:) @devtools.send_cmd('DOM.querySelector', nodeId: node_id, selector: selector) end |
#query_selector_all(node_id:, selector:) ⇒ Object
213 214 215 216 217 |
# File 'lib/selenium/devtools/v131/dom.rb', line 213 def query_selector_all(node_id:, selector:) @devtools.send_cmd('DOM.querySelectorAll', nodeId: node_id, selector: selector) end |
#redo ⇒ Object
229 230 231 |
# File 'lib/selenium/devtools/v131/dom.rb', line 229 def redo @devtools.send_cmd('DOM.redo') end |
#remove_attribute(node_id:, name:) ⇒ Object
233 234 235 236 237 |
# File 'lib/selenium/devtools/v131/dom.rb', line 233 def remove_attribute(node_id:, name:) @devtools.send_cmd('DOM.removeAttribute', nodeId: node_id, name: name) end |
#remove_node(node_id:) ⇒ Object
239 240 241 242 |
# File 'lib/selenium/devtools/v131/dom.rb', line 239 def remove_node(node_id:) @devtools.send_cmd('DOM.removeNode', nodeId: node_id) end |
#request_child_nodes(node_id:, depth: nil, pierce: nil) ⇒ Object
244 245 246 247 248 249 |
# File 'lib/selenium/devtools/v131/dom.rb', line 244 def request_child_nodes(node_id:, depth: nil, pierce: nil) @devtools.send_cmd('DOM.requestChildNodes', nodeId: node_id, depth: depth, pierce: pierce) end |
#request_node(object_id:) ⇒ Object
251 252 253 254 |
# File 'lib/selenium/devtools/v131/dom.rb', line 251 def request_node(object_id:) @devtools.send_cmd('DOM.requestNode', objectId: object_id) end |
#resolve_node(node_id: nil, backend_node_id: nil, object_group: nil, execution_context_id: nil) ⇒ Object
256 257 258 259 260 261 262 |
# File 'lib/selenium/devtools/v131/dom.rb', line 256 def resolve_node(node_id: nil, backend_node_id: nil, object_group: nil, execution_context_id: nil) @devtools.send_cmd('DOM.resolveNode', nodeId: node_id, backendNodeId: backend_node_id, objectGroup: object_group, executionContextId: execution_context_id) end |
#scroll_into_view_if_needed(node_id: nil, backend_node_id: nil, object_id: nil, rect: nil) ⇒ Object
74 75 76 77 78 79 80 |
# File 'lib/selenium/devtools/v131/dom.rb', line 74 def scroll_into_view_if_needed(node_id: nil, backend_node_id: nil, object_id: nil, rect: nil) @devtools.send_cmd('DOM.scrollIntoViewIfNeeded', nodeId: node_id, backendNodeId: backend_node_id, objectId: object_id, rect: rect) end |
#set_attribute_value(node_id:, name:, value:) ⇒ Object
264 265 266 267 268 269 |
# File 'lib/selenium/devtools/v131/dom.rb', line 264 def set_attribute_value(node_id:, name:, value:) @devtools.send_cmd('DOM.setAttributeValue', nodeId: node_id, name: name, value: value) end |
#set_attributes_as_text(node_id:, text:, name: nil) ⇒ Object
271 272 273 274 275 276 |
# File 'lib/selenium/devtools/v131/dom.rb', line 271 def set_attributes_as_text(node_id:, text:, name: nil) @devtools.send_cmd('DOM.setAttributesAsText', nodeId: node_id, text: text, name: name) end |
#set_file_input_files(files:, node_id: nil, backend_node_id: nil, object_id: nil) ⇒ Object
278 279 280 281 282 283 284 |
# File 'lib/selenium/devtools/v131/dom.rb', line 278 def set_file_input_files(files:, node_id: nil, backend_node_id: nil, object_id: nil) @devtools.send_cmd('DOM.setFileInputFiles', files: files, nodeId: node_id, backendNodeId: backend_node_id, objectId: object_id) end |
#set_inspected_node(node_id:) ⇒ Object
305 306 307 308 |
# File 'lib/selenium/devtools/v131/dom.rb', line 305 def set_inspected_node(node_id:) @devtools.send_cmd('DOM.setInspectedNode', nodeId: node_id) end |
#set_node_name(node_id:, name:) ⇒ Object
310 311 312 313 314 |
# File 'lib/selenium/devtools/v131/dom.rb', line 310 def set_node_name(node_id:, name:) @devtools.send_cmd('DOM.setNodeName', nodeId: node_id, name: name) end |
#set_node_stack_traces_enabled(enable:) ⇒ Object
286 287 288 289 |
# File 'lib/selenium/devtools/v131/dom.rb', line 286 def set_node_stack_traces_enabled(enable:) @devtools.send_cmd('DOM.setNodeStackTracesEnabled', enable: enable) end |
#set_node_value(node_id:, value:) ⇒ Object
316 317 318 319 320 |
# File 'lib/selenium/devtools/v131/dom.rb', line 316 def set_node_value(node_id:, value:) @devtools.send_cmd('DOM.setNodeValue', nodeId: node_id, value: value) end |
#set_outer_html(node_id:, outer_html:) ⇒ Object
322 323 324 325 326 |
# File 'lib/selenium/devtools/v131/dom.rb', line 322 def set_outer_html(node_id:, outer_html:) @devtools.send_cmd('DOM.setOuterHTML', nodeId: node_id, outerHTML: outer_html) end |
#undo ⇒ Object
328 329 330 |
# File 'lib/selenium/devtools/v131/dom.rb', line 328 def undo @devtools.send_cmd('DOM.undo') end |