001package Torello.Browser.BrowserAPI; 002 003// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 004// Java-HTML Imports 005// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 006 007import Torello.Browser.*; 008import Torello.Browser.helper.*; 009import Torello.Browser.JavaScriptAPI.*; 010import Torello.JSON.*; 011 012import Torello.Java.ReadOnly.ReadOnlyList; 013import Torello.Java.ReadOnly.ReadOnlyArrayList; 014 015import Torello.JavaDoc.Annotations.StaticFunctional; 016import Torello.JavaDoc.Annotations.JDHeaderBackgroundImg; 017 018import Torello.Browser.BrowserAPI.NestedHelpers.Commands.DOM$$Commands; 019 020 021// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 022// JDK Imports 023// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 024 025import javax.json.JsonObject; 026import javax.json.JsonValue; 027 028/** 029 * <SPAN CLASS=COPIEDJDK><B>This domain exposes DOM read/write operations. Each DOM Node is represented with its mirror object 030 * that has an <CODE>id</CODE>. This <CODE>id</CODE> can be used to get additional information on the Node, resolve it into 031 * the JavaScript object wrapper, etc. It is important that client receives DOM events only for the 032 * nodes that are known to the client. Backend keeps track of the nodes that were sent to the client 033 * and never sends the same node twice. It is client's responsibility to collect information about 034 * the nodes that were sent to the client. Note that <CODE>iframe</CODE> owner elements will return 035 * corresponding document elements as their child nodes.</B></SPAN> 036 * <EMBED CLASS='external-html' DATA-FILE-ID=CDP.CODE_GEN_NOTE> 037 */ 038@StaticFunctional@JDHeaderBackgroundImg(EmbedTagFileID="CDP.WOOD_PLANK_NOTE") 039public class DOM 040{ 041 // No Pubic Constructors 042 private DOM() { } 043 044 045 // ******************************************************************************************** 046 // ******************************************************************************************** 047 // Eliminated Types 048 // ******************************************************************************************** 049 // ******************************************************************************************** 050 051 052 /** 053 * Unique DOM node identifier used to reference a node that may not have been pushed to the 054 * front-end. 055 056 * <EMBED CLASS='external-html' DATA-CTAS='int' DATA-FILE-ID=CDP.EliminatedType 057 * DATA-NAME=BackendNodeId> 058 */ 059 public static final String BackendNodeId = 060 "BackendNodeId has been eliminated.\n" + 061 "It was replaced with the standard Java-Type: int"; 062 063 /** 064 * Unique DOM node identifier. 065 066 * <EMBED CLASS='external-html' DATA-CTAS='int' DATA-FILE-ID=CDP.EliminatedType 067 * DATA-NAME=NodeId> 068 */ 069 public static final String NodeId = 070 "NodeId has been eliminated.\n" + 071 "It was replaced with the standard Java-Type: int"; 072 073 /** 074 * An array of quad vertices, x immediately followed by y for each point, points clock-wise. 075 076 * <EMBED CLASS='external-html' DATA-CTAS='Number' DATA-FILE-ID=CDP.EliminatedType 077 * DATA-NAME=Quad> 078 */ 079 public static final String Quad = 080 "Quad has been eliminated.\n" + 081 "It was replaced with the standard Java-Type: Number"; 082 083 084 // ******************************************************************************************** 085 // ******************************************************************************************** 086 // Marker Events 087 // ******************************************************************************************** 088 // ******************************************************************************************** 089 090 091 /** 092 * Fired when <CODE>Document</CODE> has been totally updated. Node ids are no longer valid. 093 094 * 095 * <EMBED CLASS='external-html' DATA-FILE-ID=CDP.MarkerEvent 096 * DATA-NAME=documentUpdated> 097 */ 098 public static final String documentUpdated = "DOM.documentUpdated Marker Event"; 099 100 /** 101 * Called when top layer elements are changed. 102 * 103 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 104 105 * 106 * <EMBED CLASS='external-html' DATA-FILE-ID=CDP.MarkerEvent 107 * DATA-NAME=topLayerElementsUpdated> 108 */ 109 public static final String topLayerElementsUpdated = "DOM.topLayerElementsUpdated Marker Event"; 110 111 112 // ******************************************************************************************** 113 // ******************************************************************************************** 114 // Enumerated String Constants Lists 115 // ******************************************************************************************** 116 // ******************************************************************************************** 117 118 119 /** 120 * Document compatibility mode. 121 * <BR /><BR /><B CLASS=StrEnumType>String-Enumeration Type</B> 122 */ 123 public static final ReadOnlyList<String> CompatibilityMode = new ReadOnlyArrayList<> 124 (String.class, "LimitedQuirksMode", "NoQuirksMode", "QuirksMode"); 125 126 /** 127 * ContainerSelector logical axes 128 * <BR /><BR /><B CLASS=StrEnumType>String-Enumeration Type</B> 129 */ 130 public static final ReadOnlyList<String> LogicalAxes = new ReadOnlyArrayList<> 131 (String.class, "Block", "Both", "Inline"); 132 133 /** 134 * ContainerSelector physical axes 135 * <BR /><BR /><B CLASS=StrEnumType>String-Enumeration Type</B> 136 */ 137 public static final ReadOnlyList<String> PhysicalAxes = new ReadOnlyArrayList<> 138 (String.class, "Both", "Horizontal", "Vertical"); 139 140 /** 141 * Pseudo element type. 142 * <BR /><BR /><B CLASS=StrEnumType>String-Enumeration Type</B> 143 */ 144 public static final ReadOnlyList<String> PseudoType = new ReadOnlyArrayList<>( 145 String.class, 146 "after", "backdrop", "before", "checkmark", "column", "details-content", 147 "file-selector-button", "first-letter", "first-line", "first-line-inherited", 148 "grammar-error", "highlight", "input-list-button", "interest-hint", "marker", 149 "permission-icon", "picker", "picker-icon", "placeholder", "resizer", "scroll-button", 150 "scroll-marker", "scroll-marker-group", "scrollbar", "scrollbar-button", "scrollbar-corner", 151 "scrollbar-thumb", "scrollbar-track", "scrollbar-track-piece", "search-text", "selection", 152 "spelling-error", "target-text", "view-transition", "view-transition-group", 153 "view-transition-group-children", "view-transition-image-pair", "view-transition-new", 154 "view-transition-old" 155 ); 156 157 /** 158 * Physical scroll orientation 159 * <BR /><BR /><B CLASS=StrEnumType>String-Enumeration Type</B> 160 */ 161 public static final ReadOnlyList<String> ScrollOrientation = new ReadOnlyArrayList<> 162 (String.class, "horizontal", "vertical"); 163 164 /** 165 * Shadow root type. 166 * <BR /><BR /><B CLASS=StrEnumType>String-Enumeration Type</B> 167 */ 168 public static final ReadOnlyList<String> ShadowRootType = new ReadOnlyArrayList<> 169 (String.class, "closed", "open", "user-agent"); 170 171 172 173 // ******************************************************************************************** 174 // ******************************************************************************************** 175 // Basic Types 176 // ******************************************************************************************** 177 // ******************************************************************************************** 178 179 180 /** 181 * Backend node with a friendly name. 182 * 183 * <EMBED CLASS=globalDefs DATA-DOMAIN=DOM DATA-API=BrowserAPI> 184 */ 185 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI") 186 public static class BackendNode 187 extends BaseType<BackendNode> 188 implements java.io.Serializable 189 { 190 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 191 protected static final long serialVersionUID = 1; 192 193 private static final NestedHelper<DOM.BackendNode> singleton = 194 Torello.Browser.BrowserAPI.NestedHelpers.Types. 195 DOM$$BackendNode$$.singleton; 196 197 /** <CODE>Node</CODE>'s nodeType. */ 198 public final int nodeType; 199 200 /** <CODE>Node</CODE>'s nodeName. */ 201 public final String nodeName; 202 203 /** <CODE>[No Description Provided by Google]</CODE> */ 204 public final int backendNodeId; 205 206 /** Constructor. Please review this class' fields for documentation. */ 207 public BackendNode 208 (ReadOnlyList<Boolean> isPresent, int nodeType, String nodeName, int backendNodeId) 209 { 210 super(singleton, Domains.DOM, "BackendNode", 3); 211 212 this.nodeType = nodeType; 213 this.nodeName = nodeName; 214 this.backendNodeId = backendNodeId; 215 216 this.isPresent = (isPresent == null) 217 ? singleton.generateIsPresentList(this) 218 : THROWS.check(isPresent, 3, "DOM.BackendNode"); 219 } 220 221 /** Creates an instance of this class from a {@link JsonObject}.*/ 222 public static BackendNode fromJSON(JsonObject jo) 223 { return singleton.fromJSON(jo); } 224 225 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 226 public static NestedDescriptor<BackendNode> descriptor() 227 { return singleton.descriptor(); } 228 } 229 230 /** 231 * Box model. 232 * 233 * <EMBED CLASS=globalDefs DATA-DOMAIN=DOM DATA-API=BrowserAPI> 234 */ 235 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI") 236 public static class BoxModel 237 extends BaseType<BoxModel> 238 implements java.io.Serializable 239 { 240 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 241 protected static final long serialVersionUID = 1; 242 243 private static final NestedHelper<DOM.BoxModel> singleton = 244 Torello.Browser.BrowserAPI.NestedHelpers.Types. 245 DOM$$BoxModel$$.singleton; 246 247 /** Content box */ 248 public final Number content; 249 250 /** Padding box */ 251 public final Number padding; 252 253 /** Border box */ 254 public final Number border; 255 256 /** Margin box */ 257 public final Number margin; 258 259 /** Node width */ 260 public final int width; 261 262 /** Node height */ 263 public final int height; 264 265 /** 266 * Shape outside coordinates 267 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 268 */ 269 public final DOM.ShapeOutsideInfo shapeOutside; 270 271 /** Constructor. Please review this class' fields for documentation. */ 272 public BoxModel( 273 ReadOnlyList<Boolean> isPresent, Number content, Number padding, Number border, 274 Number margin, int width, int height, ShapeOutsideInfo shapeOutside 275 ) 276 { 277 super(singleton, Domains.DOM, "BoxModel", 7); 278 279 this.content = content; 280 this.padding = padding; 281 this.border = border; 282 this.margin = margin; 283 this.width = width; 284 this.height = height; 285 this.shapeOutside = shapeOutside; 286 287 this.isPresent = (isPresent == null) 288 ? singleton.generateIsPresentList(this) 289 : THROWS.check(isPresent, 7, "DOM.BoxModel"); 290 } 291 292 /** Creates an instance of this class from a {@link JsonObject}.*/ 293 public static BoxModel fromJSON(JsonObject jo) 294 { return singleton.fromJSON(jo); } 295 296 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 297 public static NestedDescriptor<BoxModel> descriptor() 298 { return singleton.descriptor(); } 299 } 300 301 /** 302 * <CODE>[No Description Provided by Google]</CODE> 303 * 304 * <EMBED CLASS=globalDefs DATA-DOMAIN=DOM DATA-API=BrowserAPI> 305 */ 306 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI") 307 public static class CSSComputedStyleProperty 308 extends BaseType<CSSComputedStyleProperty> 309 implements java.io.Serializable 310 { 311 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 312 protected static final long serialVersionUID = 1; 313 314 private static final NestedHelper<DOM.CSSComputedStyleProperty> singleton = 315 Torello.Browser.BrowserAPI.NestedHelpers.Types. 316 DOM$$CSSComputedStyleProperty$$.singleton; 317 318 /** Computed style property name. */ 319 public final String name; 320 321 /** Computed style property value. */ 322 public final String value; 323 324 /** Constructor. Please review this class' fields for documentation. */ 325 public CSSComputedStyleProperty(ReadOnlyList<Boolean> isPresent, String name, String value) 326 { 327 super(singleton, Domains.DOM, "CSSComputedStyleProperty", 2); 328 329 this.name = name; 330 this.value = value; 331 332 this.isPresent = (isPresent == null) 333 ? singleton.generateIsPresentList(this) 334 : THROWS.check(isPresent, 2, "DOM.CSSComputedStyleProperty"); 335 } 336 337 /** Creates an instance of this class from a {@link JsonObject}.*/ 338 public static CSSComputedStyleProperty fromJSON(JsonObject jo) 339 { return singleton.fromJSON(jo); } 340 341 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 342 public static NestedDescriptor<CSSComputedStyleProperty> descriptor() 343 { return singleton.descriptor(); } 344 } 345 346 /** 347 * A structure to hold the top-level node of a detached tree and an array of its retained descendants. 348 * 349 * <EMBED CLASS=globalDefs DATA-DOMAIN=DOM DATA-API=BrowserAPI> 350 */ 351 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI") 352 public static class DetachedElementInfo 353 extends BaseType<DetachedElementInfo> 354 implements java.io.Serializable 355 { 356 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 357 protected static final long serialVersionUID = 1; 358 359 private static final NestedHelper<DOM.DetachedElementInfo> singleton = 360 Torello.Browser.BrowserAPI.NestedHelpers.Types. 361 DOM$$DetachedElementInfo$$.singleton; 362 363 /** <CODE>[No Description Provided by Google]</CODE> */ 364 public final DOM.Node treeNode; 365 366 /** <CODE>[No Description Provided by Google]</CODE> */ 367 public final int[] retainedNodeIds; 368 369 /** Constructor. Please review this class' fields for documentation. */ 370 public DetachedElementInfo 371 (ReadOnlyList<Boolean> isPresent, Node treeNode, int[] retainedNodeIds) 372 { 373 super(singleton, Domains.DOM, "DetachedElementInfo", 2); 374 375 this.treeNode = treeNode; 376 this.retainedNodeIds = retainedNodeIds; 377 378 this.isPresent = (isPresent == null) 379 ? singleton.generateIsPresentList(this) 380 : THROWS.check(isPresent, 2, "DOM.DetachedElementInfo"); 381 } 382 383 /** Creates an instance of this class from a {@link JsonObject}.*/ 384 public static DetachedElementInfo fromJSON(JsonObject jo) 385 { return singleton.fromJSON(jo); } 386 387 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 388 public static NestedDescriptor<DetachedElementInfo> descriptor() 389 { return singleton.descriptor(); } 390 } 391 392 /** 393 * DOM interaction is implemented in terms of mirror objects that represent the actual DOM nodes. 394 * DOMNode is a base node mirror type. 395 * 396 * <EMBED CLASS=globalDefs DATA-DOMAIN=DOM DATA-API=BrowserAPI> 397 */ 398 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI") 399 public static class Node 400 extends BaseType<Node> 401 implements java.io.Serializable 402 { 403 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 404 protected static final long serialVersionUID = 1; 405 406 private static final NestedHelper<DOM.Node> singleton = 407 Torello.Browser.BrowserAPI.NestedHelpers.Types. 408 DOM$$Node$$.singleton; 409 410 /** 411 * Node identifier that is passed into the rest of the DOM messages as the <CODE>nodeId</CODE>. Backend 412 * will only push node with given <CODE>id</CODE> once. It is aware of all requested nodes and will only 413 * fire DOM events for nodes known to the client. 414 */ 415 public final int nodeId; 416 417 /** 418 * The id of the parent node if any. 419 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 420 */ 421 public final Integer parentId; 422 423 /** The BackendNodeId for this node. */ 424 public final int backendNodeId; 425 426 /** <CODE>Node</CODE>'s nodeType. */ 427 public final int nodeType; 428 429 /** <CODE>Node</CODE>'s nodeName. */ 430 public final String nodeName; 431 432 /** <CODE>Node</CODE>'s localName. */ 433 public final String localName; 434 435 /** <CODE>Node</CODE>'s nodeValue. */ 436 public final String nodeValue; 437 438 /** 439 * Child count for <CODE>Container</CODE> nodes. 440 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 441 */ 442 public final Integer childNodeCount; 443 444 /** 445 * Child nodes of this node when requested with children. 446 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 447 */ 448 public final DOM.Node[] children; 449 450 /** 451 * Attributes of the <CODE>Element</CODE> node in the form of flat array <CODE>[name1, value1, name2, value2]</CODE>. 452 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 453 */ 454 public final String[] attributes; 455 456 /** 457 * Document URL that <CODE>Document</CODE> or <CODE>FrameOwner</CODE> node points to. 458 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 459 */ 460 public final String documentURL; 461 462 /** 463 * Base URL that <CODE>Document</CODE> or <CODE>FrameOwner</CODE> node uses for URL completion. 464 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 465 */ 466 public final String baseURL; 467 468 /** 469 * <CODE>DocumentType</CODE>'s publicId. 470 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 471 */ 472 public final String publicId; 473 474 /** 475 * <CODE>DocumentType</CODE>'s systemId. 476 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 477 */ 478 public final String systemId; 479 480 /** 481 * <CODE>DocumentType</CODE>'s internalSubset. 482 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 483 */ 484 public final String internalSubset; 485 486 /** 487 * <CODE>Document</CODE>'s XML version in case of XML documents. 488 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 489 */ 490 public final String xmlVersion; 491 492 /** 493 * <CODE>Attr</CODE>'s name. 494 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 495 */ 496 public final String name; 497 498 /** 499 * <CODE>Attr</CODE>'s value. 500 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 501 */ 502 public final String value; 503 504 /** 505 * Pseudo element type for this node. 506 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 507 * <EMBED CLASS='external-html' DATA-D=DOM DATA-C=PseudoType DATA-F=pseudoType DATA-FILE-ID=CDP.EL2> 508 * @see BaseType#enumStrList(String) 509 */ 510 public final String pseudoType; 511 512 /** 513 * Pseudo element identifier for this node. Only present if there is a 514 * valid pseudoType. 515 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 516 */ 517 public final String pseudoIdentifier; 518 519 /** 520 * Shadow root type. 521 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 522 * <EMBED CLASS='external-html' DATA-D=DOM DATA-C=ShadowRootType DATA-F=shadowRootType DATA-FILE-ID=CDP.EL2> 523 * @see BaseType#enumStrList(String) 524 */ 525 public final String shadowRootType; 526 527 /** 528 * Frame ID for frame owner elements. 529 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 530 */ 531 public final String frameId; 532 533 /** 534 * Content document for frame owner elements. 535 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 536 */ 537 public final DOM.Node contentDocument; 538 539 /** 540 * Shadow root list for given element host. 541 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 542 */ 543 public final DOM.Node[] shadowRoots; 544 545 /** 546 * Content document fragment for template elements. 547 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 548 */ 549 public final DOM.Node templateContent; 550 551 /** 552 * Pseudo elements associated with this node. 553 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 554 */ 555 public final DOM.Node[] pseudoElements; 556 557 /** 558 * Deprecated, as the HTML Imports API has been removed (crbug.com/937746). 559 * This property used to return the imported document for the HTMLImport links. 560 * The property is always undefined now. 561 * <BR /><B CLASS=Opt-Top>OPTIONAL</B><B CLASS=Dep-Top>DEPRECATED</B> 562 */ 563 public final DOM.Node importedDocument; 564 565 /** 566 * Distributed nodes for given insertion point. 567 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 568 */ 569 public final DOM.BackendNode[] distributedNodes; 570 571 /** 572 * Whether the node is SVG. 573 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 574 */ 575 public final Boolean isSVG; 576 577 /** 578 * <CODE>[No Description Provided by Google]</CODE> 579 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 580 * <EMBED CLASS='external-html' DATA-D=DOM DATA-C=CompatibilityMode DATA-F=compatibilityMode DATA-FILE-ID=CDP.EL2> 581 * @see BaseType#enumStrList(String) 582 */ 583 public final String compatibilityMode; 584 585 /** 586 * <CODE>[No Description Provided by Google]</CODE> 587 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 588 */ 589 public final DOM.BackendNode assignedSlot; 590 591 /** 592 * <CODE>[No Description Provided by Google]</CODE> 593 * <BR /><B CLASS=Opt-Top>OPTIONAL</B><B CLASS=Exp-Top>EXPERIMENTAL</B> 594 */ 595 public final Boolean isScrollable; 596 597 /** Constructor. Please review this class' fields for documentation. */ 598 public Node( 599 ReadOnlyList<Boolean> isPresent, int nodeId, Integer parentId, int backendNodeId, 600 int nodeType, String nodeName, String localName, String nodeValue, 601 Integer childNodeCount, Node[] children, String[] attributes, String documentURL, 602 String baseURL, String publicId, String systemId, String internalSubset, 603 String xmlVersion, String name, String value, String pseudoType, 604 String pseudoIdentifier, String shadowRootType, String frameId, 605 Node contentDocument, Node[] shadowRoots, Node templateContent, 606 Node[] pseudoElements, Node importedDocument, BackendNode[] distributedNodes, 607 Boolean isSVG, String compatibilityMode, BackendNode assignedSlot, 608 Boolean isScrollable 609 ) 610 { 611 super(singleton, Domains.DOM, "Node", 32); 612 613 this.nodeId = nodeId; 614 this.parentId = parentId; 615 this.backendNodeId = backendNodeId; 616 this.nodeType = nodeType; 617 this.nodeName = nodeName; 618 this.localName = localName; 619 this.nodeValue = nodeValue; 620 this.childNodeCount = childNodeCount; 621 this.children = children; 622 this.attributes = attributes; 623 this.documentURL = documentURL; 624 this.baseURL = baseURL; 625 this.publicId = publicId; 626 this.systemId = systemId; 627 this.internalSubset = internalSubset; 628 this.xmlVersion = xmlVersion; 629 this.name = name; 630 this.value = value; 631 this.pseudoType = pseudoType; 632 this.pseudoIdentifier = pseudoIdentifier; 633 this.shadowRootType = shadowRootType; 634 this.frameId = frameId; 635 this.contentDocument = contentDocument; 636 this.shadowRoots = shadowRoots; 637 this.templateContent = templateContent; 638 this.pseudoElements = pseudoElements; 639 this.importedDocument = importedDocument; 640 this.distributedNodes = distributedNodes; 641 this.isSVG = isSVG; 642 this.compatibilityMode = compatibilityMode; 643 this.assignedSlot = assignedSlot; 644 this.isScrollable = isScrollable; 645 646 this.isPresent = (isPresent == null) 647 ? singleton.generateIsPresentList(this) 648 : THROWS.check(isPresent, 32, "DOM.Node"); 649 } 650 651 /** Creates an instance of this class from a {@link JsonObject}.*/ 652 public static Node fromJSON(JsonObject jo) 653 { return singleton.fromJSON(jo); } 654 655 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 656 public static NestedDescriptor<Node> descriptor() 657 { return singleton.descriptor(); } 658 } 659 660 /** 661 * A structure holding an RGBA color. 662 * 663 * <EMBED CLASS=globalDefs DATA-DOMAIN=DOM DATA-API=BrowserAPI> 664 */ 665 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI") 666 public static class RGBA 667 extends BaseType<RGBA> 668 implements java.io.Serializable 669 { 670 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 671 protected static final long serialVersionUID = 1; 672 673 private static final NestedHelper<DOM.RGBA> singleton = 674 Torello.Browser.BrowserAPI.NestedHelpers.Types. 675 DOM$$RGBA$$.singleton; 676 677 /** The red component, in the [0-255] range. */ 678 public final int r; 679 680 /** The green component, in the [0-255] range. */ 681 public final int g; 682 683 /** The blue component, in the [0-255] range. */ 684 public final int b; 685 686 /** 687 * The alpha component, in the [0-1] range (default: 1). 688 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 689 */ 690 public final Number a; 691 692 /** Constructor. Please review this class' fields for documentation. */ 693 public RGBA(ReadOnlyList<Boolean> isPresent, int r, int g, int b, Number a) 694 { 695 super(singleton, Domains.DOM, "RGBA", 4); 696 697 this.r = r; 698 this.g = g; 699 this.b = b; 700 this.a = a; 701 702 this.isPresent = (isPresent == null) 703 ? singleton.generateIsPresentList(this) 704 : THROWS.check(isPresent, 4, "DOM.RGBA"); 705 } 706 707 /** Creates an instance of this class from a {@link JsonObject}.*/ 708 public static RGBA fromJSON(JsonObject jo) 709 { return singleton.fromJSON(jo); } 710 711 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 712 public static NestedDescriptor<RGBA> descriptor() 713 { return singleton.descriptor(); } 714 } 715 716 /** 717 * Rectangle. 718 * 719 * <EMBED CLASS=globalDefs DATA-DOMAIN=DOM DATA-API=BrowserAPI> 720 */ 721 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI") 722 public static class Rect 723 extends BaseType<Rect> 724 implements java.io.Serializable 725 { 726 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 727 protected static final long serialVersionUID = 1; 728 729 private static final NestedHelper<DOM.Rect> singleton = 730 Torello.Browser.BrowserAPI.NestedHelpers.Types. 731 DOM$$Rect$$.singleton; 732 733 /** X coordinate */ 734 public final Number x; 735 736 /** Y coordinate */ 737 public final Number y; 738 739 /** Rectangle width */ 740 public final Number width; 741 742 /** Rectangle height */ 743 public final Number height; 744 745 /** Constructor. Please review this class' fields for documentation. */ 746 public Rect 747 (ReadOnlyList<Boolean> isPresent, Number x, Number y, Number width, Number height) 748 { 749 super(singleton, Domains.DOM, "Rect", 4); 750 751 this.x = x; 752 this.y = y; 753 this.width = width; 754 this.height = height; 755 756 this.isPresent = (isPresent == null) 757 ? singleton.generateIsPresentList(this) 758 : THROWS.check(isPresent, 4, "DOM.Rect"); 759 } 760 761 /** Creates an instance of this class from a {@link JsonObject}.*/ 762 public static Rect fromJSON(JsonObject jo) 763 { return singleton.fromJSON(jo); } 764 765 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 766 public static NestedDescriptor<Rect> descriptor() 767 { return singleton.descriptor(); } 768 } 769 770 /** 771 * CSS Shape Outside details. 772 * 773 * <EMBED CLASS=globalDefs DATA-DOMAIN=DOM DATA-API=BrowserAPI> 774 */ 775 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI") 776 public static class ShapeOutsideInfo 777 extends BaseType<ShapeOutsideInfo> 778 implements java.io.Serializable 779 { 780 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 781 protected static final long serialVersionUID = 1; 782 783 private static final NestedHelper<DOM.ShapeOutsideInfo> singleton = 784 Torello.Browser.BrowserAPI.NestedHelpers.Types. 785 DOM$$ShapeOutsideInfo$$.singleton; 786 787 /** Shape bounds */ 788 public final Number bounds; 789 790 /** Shape coordinate details */ 791 public final JsonValue shape; 792 793 /** Margin shape bounds */ 794 public final JsonValue marginShape; 795 796 /** Constructor. Please review this class' fields for documentation. */ 797 public ShapeOutsideInfo( 798 ReadOnlyList<Boolean> isPresent, Number bounds, JsonValue shape, 799 JsonValue marginShape 800 ) 801 { 802 super(singleton, Domains.DOM, "ShapeOutsideInfo", 3); 803 804 this.bounds = bounds; 805 this.shape = shape; 806 this.marginShape = marginShape; 807 808 this.isPresent = (isPresent == null) 809 ? singleton.generateIsPresentList(this) 810 : THROWS.check(isPresent, 3, "DOM.ShapeOutsideInfo"); 811 } 812 813 /** Creates an instance of this class from a {@link JsonObject}.*/ 814 public static ShapeOutsideInfo fromJSON(JsonObject jo) 815 { return singleton.fromJSON(jo); } 816 817 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 818 public static NestedDescriptor<ShapeOutsideInfo> descriptor() 819 { return singleton.descriptor(); } 820 } 821 822 823 // ******************************************************************************************** 824 // ******************************************************************************************** 825 // Command-Return Types 826 // ******************************************************************************************** 827 // ******************************************************************************************** 828 829 830 /** 831 * Returns iframe node that owns iframe with the given domain. 832 * 833 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 834 * <EMBED CLASS=globalDefs DATA-DOMAIN=DOM DATA-API=BrowserAPI DATA-CMD=getFrameOwner> 835 * @see DOM#getFrameOwner 836 */ 837 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_CMD_JDHBI") 838 public static class getFrameOwner$$RET 839 extends BaseType<getFrameOwner$$RET> 840 implements java.io.Serializable 841 { 842 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 843 protected static final long serialVersionUID = 1; 844 845 private static final NestedHelper<DOM.getFrameOwner$$RET> singleton = 846 Torello.Browser.BrowserAPI.NestedHelpers.CmdReturns. 847 DOM$$getFrameOwner$$RET.singleton; 848 849 /** Resulting node. */ 850 public final int backendNodeId; 851 852 /** 853 * Id of the node at given coordinates, only when enabled and requested document. 854 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 855 */ 856 public final Integer nodeId; 857 858 /** Constructor. Please review this class' fields for documentation. */ 859 public getFrameOwner$$RET 860 (ReadOnlyList<Boolean> isPresent, int backendNodeId, Integer nodeId) 861 { 862 super(singleton, Domains.DOM, "getFrameOwner", 2); 863 864 this.backendNodeId = backendNodeId; 865 this.nodeId = nodeId; 866 867 this.isPresent = (isPresent == null) 868 ? singleton.generateIsPresentList(this) 869 : THROWS.check(isPresent, 2, "DOM.getFrameOwner$$RET"); 870 } 871 872 /** Creates an instance of this class from a {@link JsonObject}.*/ 873 public static getFrameOwner$$RET fromJSON(JsonObject jo) 874 { return singleton.fromJSON(jo); } 875 876 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 877 public static NestedDescriptor<getFrameOwner$$RET> descriptor() 878 { return singleton.descriptor(); } 879 } 880 881 /** 882 * Returns node id at given location. Depending on whether DOM domain is enabled, nodeId is 883 * either returned or not. 884 * 885 * <EMBED CLASS=globalDefs DATA-DOMAIN=DOM DATA-API=BrowserAPI DATA-CMD=getNodeForLocation> 886 * @see DOM#getNodeForLocation 887 */ 888 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_CMD_JDHBI") 889 public static class getNodeForLocation$$RET 890 extends BaseType<getNodeForLocation$$RET> 891 implements java.io.Serializable 892 { 893 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 894 protected static final long serialVersionUID = 1; 895 896 private static final NestedHelper<DOM.getNodeForLocation$$RET> singleton = 897 Torello.Browser.BrowserAPI.NestedHelpers.CmdReturns. 898 DOM$$getNodeForLocation$$RET.singleton; 899 900 /** Resulting node. */ 901 public final int backendNodeId; 902 903 /** Frame this node belongs to. */ 904 public final String frameId; 905 906 /** 907 * Id of the node at given coordinates, only when enabled and requested document. 908 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 909 */ 910 public final Integer nodeId; 911 912 /** Constructor. Please review this class' fields for documentation. */ 913 public getNodeForLocation$$RET 914 (ReadOnlyList<Boolean> isPresent, int backendNodeId, String frameId, Integer nodeId) 915 { 916 super(singleton, Domains.DOM, "getNodeForLocation", 3); 917 918 this.backendNodeId = backendNodeId; 919 this.frameId = frameId; 920 this.nodeId = nodeId; 921 922 this.isPresent = (isPresent == null) 923 ? singleton.generateIsPresentList(this) 924 : THROWS.check(isPresent, 3, "DOM.getNodeForLocation$$RET"); 925 } 926 927 /** Creates an instance of this class from a {@link JsonObject}.*/ 928 public static getNodeForLocation$$RET fromJSON(JsonObject jo) 929 { return singleton.fromJSON(jo); } 930 931 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 932 public static NestedDescriptor<getNodeForLocation$$RET> descriptor() 933 { return singleton.descriptor(); } 934 } 935 936 /** 937 * Searches for a given string in the DOM tree. Use <CODE>getSearchResults</CODE> to access search results or 938 * <CODE>cancelSearch</CODE> to end this search session. 939 * 940 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 941 * <EMBED CLASS=globalDefs DATA-DOMAIN=DOM DATA-API=BrowserAPI DATA-CMD=performSearch> 942 * @see DOM#performSearch 943 */ 944 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_CMD_JDHBI") 945 public static class performSearch$$RET 946 extends BaseType<performSearch$$RET> 947 implements java.io.Serializable 948 { 949 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 950 protected static final long serialVersionUID = 1; 951 952 private static final NestedHelper<DOM.performSearch$$RET> singleton = 953 Torello.Browser.BrowserAPI.NestedHelpers.CmdReturns. 954 DOM$$performSearch$$RET.singleton; 955 956 /** Unique search session identifier. */ 957 public final String searchId; 958 959 /** Number of search results. */ 960 public final int resultCount; 961 962 /** Constructor. Please review this class' fields for documentation. */ 963 public performSearch$$RET 964 (ReadOnlyList<Boolean> isPresent, String searchId, int resultCount) 965 { 966 super(singleton, Domains.DOM, "performSearch", 2); 967 968 this.searchId = searchId; 969 this.resultCount = resultCount; 970 971 this.isPresent = (isPresent == null) 972 ? singleton.generateIsPresentList(this) 973 : THROWS.check(isPresent, 2, "DOM.performSearch$$RET"); 974 } 975 976 /** Creates an instance of this class from a {@link JsonObject}.*/ 977 public static performSearch$$RET fromJSON(JsonObject jo) 978 { return singleton.fromJSON(jo); } 979 980 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 981 public static NestedDescriptor<performSearch$$RET> descriptor() 982 { return singleton.descriptor(); } 983 } 984 985 986 // ******************************************************************************************** 987 // ******************************************************************************************** 988 // Event Types 989 // ******************************************************************************************** 990 // ******************************************************************************************** 991 992 993 /** 994 * Fired when <CODE>Element</CODE>'s attribute is modified. 995 * 996 * <EMBED CLASS=globalDefs DATA-DOMAIN=DOM DATA-API=BrowserAPI> 997 */ 998 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_EVENT_JDHBI") 999 public static class attributeModified 1000 extends BrowserEvent<attributeModified> 1001 implements java.io.Serializable 1002 { 1003 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 1004 protected static final long serialVersionUID = 1; 1005 1006 private static final NestedHelper<DOM.attributeModified> singleton = 1007 Torello.Browser.BrowserAPI.NestedHelpers.Events. 1008 DOM$$attributeModified$$.singleton; 1009 1010 /** Id of the node that has changed. */ 1011 public final int nodeId; 1012 1013 /** Attribute name. */ 1014 public final String name; 1015 1016 /** Attribute value. */ 1017 public final String value; 1018 1019 /** Constructor. Please review this class' fields for documentation. */ 1020 public attributeModified 1021 (ReadOnlyList<Boolean> isPresent, int nodeId, String name, String value) 1022 { 1023 super(singleton, Domains.DOM, "attributeModified", 3); 1024 1025 this.nodeId = nodeId; 1026 this.name = name; 1027 this.value = value; 1028 1029 this.isPresent = (isPresent == null) 1030 ? singleton.generateIsPresentList(this) 1031 : THROWS.check(isPresent, 3, "DOM.attributeModified"); 1032 } 1033 1034 /** Creates an instance of this class from a {@link JsonObject}.*/ 1035 public static attributeModified fromJSON(JsonObject jo) 1036 { return singleton.fromJSON(jo); } 1037 1038 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 1039 public static NestedDescriptor<attributeModified> descriptor() 1040 { return singleton.descriptor(); } 1041 } 1042 1043 /** 1044 * Fired when <CODE>Element</CODE>'s attribute is removed. 1045 * 1046 * <EMBED CLASS=globalDefs DATA-DOMAIN=DOM DATA-API=BrowserAPI> 1047 */ 1048 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_EVENT_JDHBI") 1049 public static class attributeRemoved 1050 extends BrowserEvent<attributeRemoved> 1051 implements java.io.Serializable 1052 { 1053 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 1054 protected static final long serialVersionUID = 1; 1055 1056 private static final NestedHelper<DOM.attributeRemoved> singleton = 1057 Torello.Browser.BrowserAPI.NestedHelpers.Events. 1058 DOM$$attributeRemoved$$.singleton; 1059 1060 /** Id of the node that has changed. */ 1061 public final int nodeId; 1062 1063 /** A ttribute name. */ 1064 public final String name; 1065 1066 /** Constructor. Please review this class' fields for documentation. */ 1067 public attributeRemoved(ReadOnlyList<Boolean> isPresent, int nodeId, String name) 1068 { 1069 super(singleton, Domains.DOM, "attributeRemoved", 2); 1070 1071 this.nodeId = nodeId; 1072 this.name = name; 1073 1074 this.isPresent = (isPresent == null) 1075 ? singleton.generateIsPresentList(this) 1076 : THROWS.check(isPresent, 2, "DOM.attributeRemoved"); 1077 } 1078 1079 /** Creates an instance of this class from a {@link JsonObject}.*/ 1080 public static attributeRemoved fromJSON(JsonObject jo) 1081 { return singleton.fromJSON(jo); } 1082 1083 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 1084 public static NestedDescriptor<attributeRemoved> descriptor() 1085 { return singleton.descriptor(); } 1086 } 1087 1088 /** 1089 * Mirrors <CODE>DOMCharacterDataModified</CODE> event. 1090 * 1091 * <EMBED CLASS=globalDefs DATA-DOMAIN=DOM DATA-API=BrowserAPI> 1092 */ 1093 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_EVENT_JDHBI") 1094 public static class characterDataModified 1095 extends BrowserEvent<characterDataModified> 1096 implements java.io.Serializable 1097 { 1098 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 1099 protected static final long serialVersionUID = 1; 1100 1101 private static final NestedHelper<DOM.characterDataModified> singleton = 1102 Torello.Browser.BrowserAPI.NestedHelpers.Events. 1103 DOM$$characterDataModified$$.singleton; 1104 1105 /** Id of the node that has changed. */ 1106 public final int nodeId; 1107 1108 /** New text value. */ 1109 public final String characterData; 1110 1111 /** Constructor. Please review this class' fields for documentation. */ 1112 public characterDataModified 1113 (ReadOnlyList<Boolean> isPresent, int nodeId, String characterData) 1114 { 1115 super(singleton, Domains.DOM, "characterDataModified", 2); 1116 1117 this.nodeId = nodeId; 1118 this.characterData = characterData; 1119 1120 this.isPresent = (isPresent == null) 1121 ? singleton.generateIsPresentList(this) 1122 : THROWS.check(isPresent, 2, "DOM.characterDataModified"); 1123 } 1124 1125 /** Creates an instance of this class from a {@link JsonObject}.*/ 1126 public static characterDataModified fromJSON(JsonObject jo) 1127 { return singleton.fromJSON(jo); } 1128 1129 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 1130 public static NestedDescriptor<characterDataModified> descriptor() 1131 { return singleton.descriptor(); } 1132 } 1133 1134 /** 1135 * Fired when <CODE>Container</CODE>'s child node count has changed. 1136 * 1137 * <EMBED CLASS=globalDefs DATA-DOMAIN=DOM DATA-API=BrowserAPI> 1138 */ 1139 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_EVENT_JDHBI") 1140 public static class childNodeCountUpdated 1141 extends BrowserEvent<childNodeCountUpdated> 1142 implements java.io.Serializable 1143 { 1144 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 1145 protected static final long serialVersionUID = 1; 1146 1147 private static final NestedHelper<DOM.childNodeCountUpdated> singleton = 1148 Torello.Browser.BrowserAPI.NestedHelpers.Events. 1149 DOM$$childNodeCountUpdated$$.singleton; 1150 1151 /** Id of the node that has changed. */ 1152 public final int nodeId; 1153 1154 /** New node count. */ 1155 public final int childNodeCount; 1156 1157 /** Constructor. Please review this class' fields for documentation. */ 1158 public childNodeCountUpdated 1159 (ReadOnlyList<Boolean> isPresent, int nodeId, int childNodeCount) 1160 { 1161 super(singleton, Domains.DOM, "childNodeCountUpdated", 2); 1162 1163 this.nodeId = nodeId; 1164 this.childNodeCount = childNodeCount; 1165 1166 this.isPresent = (isPresent == null) 1167 ? singleton.generateIsPresentList(this) 1168 : THROWS.check(isPresent, 2, "DOM.childNodeCountUpdated"); 1169 } 1170 1171 /** Creates an instance of this class from a {@link JsonObject}.*/ 1172 public static childNodeCountUpdated fromJSON(JsonObject jo) 1173 { return singleton.fromJSON(jo); } 1174 1175 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 1176 public static NestedDescriptor<childNodeCountUpdated> descriptor() 1177 { return singleton.descriptor(); } 1178 } 1179 1180 /** 1181 * Mirrors <CODE>DOMNodeInserted</CODE> event. 1182 * 1183 * <EMBED CLASS=globalDefs DATA-DOMAIN=DOM DATA-API=BrowserAPI> 1184 */ 1185 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_EVENT_JDHBI") 1186 public static class childNodeInserted 1187 extends BrowserEvent<childNodeInserted> 1188 implements java.io.Serializable 1189 { 1190 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 1191 protected static final long serialVersionUID = 1; 1192 1193 private static final NestedHelper<DOM.childNodeInserted> singleton = 1194 Torello.Browser.BrowserAPI.NestedHelpers.Events. 1195 DOM$$childNodeInserted$$.singleton; 1196 1197 /** Id of the node that has changed. */ 1198 public final int parentNodeId; 1199 1200 /** Id of the previous sibling. */ 1201 public final int previousNodeId; 1202 1203 /** Inserted node data. */ 1204 public final DOM.Node node; 1205 1206 /** Constructor. Please review this class' fields for documentation. */ 1207 public childNodeInserted 1208 (ReadOnlyList<Boolean> isPresent, int parentNodeId, int previousNodeId, Node node) 1209 { 1210 super(singleton, Domains.DOM, "childNodeInserted", 3); 1211 1212 this.parentNodeId = parentNodeId; 1213 this.previousNodeId = previousNodeId; 1214 this.node = node; 1215 1216 this.isPresent = (isPresent == null) 1217 ? singleton.generateIsPresentList(this) 1218 : THROWS.check(isPresent, 3, "DOM.childNodeInserted"); 1219 } 1220 1221 /** Creates an instance of this class from a {@link JsonObject}.*/ 1222 public static childNodeInserted fromJSON(JsonObject jo) 1223 { return singleton.fromJSON(jo); } 1224 1225 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 1226 public static NestedDescriptor<childNodeInserted> descriptor() 1227 { return singleton.descriptor(); } 1228 } 1229 1230 /** 1231 * Mirrors <CODE>DOMNodeRemoved</CODE> event. 1232 * 1233 * <EMBED CLASS=globalDefs DATA-DOMAIN=DOM DATA-API=BrowserAPI> 1234 */ 1235 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_EVENT_JDHBI") 1236 public static class childNodeRemoved 1237 extends BrowserEvent<childNodeRemoved> 1238 implements java.io.Serializable 1239 { 1240 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 1241 protected static final long serialVersionUID = 1; 1242 1243 private static final NestedHelper<DOM.childNodeRemoved> singleton = 1244 Torello.Browser.BrowserAPI.NestedHelpers.Events. 1245 DOM$$childNodeRemoved$$.singleton; 1246 1247 /** Parent id. */ 1248 public final int parentNodeId; 1249 1250 /** Id of the node that has been removed. */ 1251 public final int nodeId; 1252 1253 /** Constructor. Please review this class' fields for documentation. */ 1254 public childNodeRemoved(ReadOnlyList<Boolean> isPresent, int parentNodeId, int nodeId) 1255 { 1256 super(singleton, Domains.DOM, "childNodeRemoved", 2); 1257 1258 this.parentNodeId = parentNodeId; 1259 this.nodeId = nodeId; 1260 1261 this.isPresent = (isPresent == null) 1262 ? singleton.generateIsPresentList(this) 1263 : THROWS.check(isPresent, 2, "DOM.childNodeRemoved"); 1264 } 1265 1266 /** Creates an instance of this class from a {@link JsonObject}.*/ 1267 public static childNodeRemoved fromJSON(JsonObject jo) 1268 { return singleton.fromJSON(jo); } 1269 1270 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 1271 public static NestedDescriptor<childNodeRemoved> descriptor() 1272 { return singleton.descriptor(); } 1273 } 1274 1275 /** 1276 * Called when distribution is changed. 1277 * 1278 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 1279 * <EMBED CLASS=globalDefs DATA-DOMAIN=DOM DATA-API=BrowserAPI> 1280 */ 1281 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_EVENT_JDHBI") 1282 public static class distributedNodesUpdated 1283 extends BrowserEvent<distributedNodesUpdated> 1284 implements java.io.Serializable 1285 { 1286 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 1287 protected static final long serialVersionUID = 1; 1288 1289 private static final NestedHelper<DOM.distributedNodesUpdated> singleton = 1290 Torello.Browser.BrowserAPI.NestedHelpers.Events. 1291 DOM$$distributedNodesUpdated$$.singleton; 1292 1293 /** Insertion point where distributed nodes were updated. */ 1294 public final int insertionPointId; 1295 1296 /** Distributed nodes for given insertion point. */ 1297 public final DOM.BackendNode[] distributedNodes; 1298 1299 /** Constructor. Please review this class' fields for documentation. */ 1300 public distributedNodesUpdated 1301 (ReadOnlyList<Boolean> isPresent, int insertionPointId, BackendNode[] distributedNodes) 1302 { 1303 super(singleton, Domains.DOM, "distributedNodesUpdated", 2); 1304 1305 this.insertionPointId = insertionPointId; 1306 this.distributedNodes = distributedNodes; 1307 1308 this.isPresent = (isPresent == null) 1309 ? singleton.generateIsPresentList(this) 1310 : THROWS.check(isPresent, 2, "DOM.distributedNodesUpdated"); 1311 } 1312 1313 /** Creates an instance of this class from a {@link JsonObject}.*/ 1314 public static distributedNodesUpdated fromJSON(JsonObject jo) 1315 { return singleton.fromJSON(jo); } 1316 1317 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 1318 public static NestedDescriptor<distributedNodesUpdated> descriptor() 1319 { return singleton.descriptor(); } 1320 } 1321 1322 /** 1323 * Fired when <CODE>Element</CODE>'s inline style is modified via a CSS property modification. 1324 * 1325 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 1326 * <EMBED CLASS=globalDefs DATA-DOMAIN=DOM DATA-API=BrowserAPI> 1327 */ 1328 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_EVENT_JDHBI") 1329 public static class inlineStyleInvalidated 1330 extends BrowserEvent<inlineStyleInvalidated> 1331 implements java.io.Serializable 1332 { 1333 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 1334 protected static final long serialVersionUID = 1; 1335 1336 private static final NestedHelper<DOM.inlineStyleInvalidated> singleton = 1337 Torello.Browser.BrowserAPI.NestedHelpers.Events. 1338 DOM$$inlineStyleInvalidated$$.singleton; 1339 1340 /** Ids of the nodes for which the inline styles have been invalidated. */ 1341 public final int[] nodeIds; 1342 1343 /** Constructor. Please review this class' fields for documentation. */ 1344 public inlineStyleInvalidated(ReadOnlyList<Boolean> isPresent, int[] nodeIds) 1345 { 1346 super(singleton, Domains.DOM, "inlineStyleInvalidated", 1); 1347 1348 this.nodeIds = nodeIds; 1349 1350 this.isPresent = (isPresent == null) 1351 ? singleton.generateIsPresentList(this) 1352 : THROWS.check(isPresent, 1, "DOM.inlineStyleInvalidated"); 1353 } 1354 1355 /** Creates an instance of this class from a {@link JsonObject}.*/ 1356 public static inlineStyleInvalidated fromJSON(JsonObject jo) 1357 { return singleton.fromJSON(jo); } 1358 1359 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 1360 public static NestedDescriptor<inlineStyleInvalidated> descriptor() 1361 { return singleton.descriptor(); } 1362 } 1363 1364 /** 1365 * Called when a pseudo element is added to an element. 1366 * 1367 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 1368 * <EMBED CLASS=globalDefs DATA-DOMAIN=DOM DATA-API=BrowserAPI> 1369 */ 1370 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_EVENT_JDHBI") 1371 public static class pseudoElementAdded 1372 extends BrowserEvent<pseudoElementAdded> 1373 implements java.io.Serializable 1374 { 1375 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 1376 protected static final long serialVersionUID = 1; 1377 1378 private static final NestedHelper<DOM.pseudoElementAdded> singleton = 1379 Torello.Browser.BrowserAPI.NestedHelpers.Events. 1380 DOM$$pseudoElementAdded$$.singleton; 1381 1382 /** Pseudo element's parent element id. */ 1383 public final int parentId; 1384 1385 /** The added pseudo element. */ 1386 public final DOM.Node pseudoElement; 1387 1388 /** Constructor. Please review this class' fields for documentation. */ 1389 public pseudoElementAdded 1390 (ReadOnlyList<Boolean> isPresent, int parentId, Node pseudoElement) 1391 { 1392 super(singleton, Domains.DOM, "pseudoElementAdded", 2); 1393 1394 this.parentId = parentId; 1395 this.pseudoElement = pseudoElement; 1396 1397 this.isPresent = (isPresent == null) 1398 ? singleton.generateIsPresentList(this) 1399 : THROWS.check(isPresent, 2, "DOM.pseudoElementAdded"); 1400 } 1401 1402 /** Creates an instance of this class from a {@link JsonObject}.*/ 1403 public static pseudoElementAdded fromJSON(JsonObject jo) 1404 { return singleton.fromJSON(jo); } 1405 1406 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 1407 public static NestedDescriptor<pseudoElementAdded> descriptor() 1408 { return singleton.descriptor(); } 1409 } 1410 1411 /** 1412 * Called when a pseudo element is removed from an element. 1413 * 1414 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 1415 * <EMBED CLASS=globalDefs DATA-DOMAIN=DOM DATA-API=BrowserAPI> 1416 */ 1417 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_EVENT_JDHBI") 1418 public static class pseudoElementRemoved 1419 extends BrowserEvent<pseudoElementRemoved> 1420 implements java.io.Serializable 1421 { 1422 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 1423 protected static final long serialVersionUID = 1; 1424 1425 private static final NestedHelper<DOM.pseudoElementRemoved> singleton = 1426 Torello.Browser.BrowserAPI.NestedHelpers.Events. 1427 DOM$$pseudoElementRemoved$$.singleton; 1428 1429 /** Pseudo element's parent element id. */ 1430 public final int parentId; 1431 1432 /** The removed pseudo element id. */ 1433 public final int pseudoElementId; 1434 1435 /** Constructor. Please review this class' fields for documentation. */ 1436 public pseudoElementRemoved 1437 (ReadOnlyList<Boolean> isPresent, int parentId, int pseudoElementId) 1438 { 1439 super(singleton, Domains.DOM, "pseudoElementRemoved", 2); 1440 1441 this.parentId = parentId; 1442 this.pseudoElementId = pseudoElementId; 1443 1444 this.isPresent = (isPresent == null) 1445 ? singleton.generateIsPresentList(this) 1446 : THROWS.check(isPresent, 2, "DOM.pseudoElementRemoved"); 1447 } 1448 1449 /** Creates an instance of this class from a {@link JsonObject}.*/ 1450 public static pseudoElementRemoved fromJSON(JsonObject jo) 1451 { return singleton.fromJSON(jo); } 1452 1453 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 1454 public static NestedDescriptor<pseudoElementRemoved> descriptor() 1455 { return singleton.descriptor(); } 1456 } 1457 1458 /** 1459 * Fired when a node's scrollability state changes. 1460 * 1461 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 1462 * <EMBED CLASS=globalDefs DATA-DOMAIN=DOM DATA-API=BrowserAPI> 1463 */ 1464 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_EVENT_JDHBI") 1465 public static class scrollableFlagUpdated 1466 extends BrowserEvent<scrollableFlagUpdated> 1467 implements java.io.Serializable 1468 { 1469 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 1470 protected static final long serialVersionUID = 1; 1471 1472 private static final NestedHelper<DOM.scrollableFlagUpdated> singleton = 1473 Torello.Browser.BrowserAPI.NestedHelpers.Events. 1474 DOM$$scrollableFlagUpdated$$.singleton; 1475 1476 /** The id of the node. */ 1477 public final int nodeId; 1478 1479 /** If the node is scrollable. */ 1480 public final boolean isScrollable; 1481 1482 /** Constructor. Please review this class' fields for documentation. */ 1483 public scrollableFlagUpdated 1484 (ReadOnlyList<Boolean> isPresent, int nodeId, boolean isScrollable) 1485 { 1486 super(singleton, Domains.DOM, "scrollableFlagUpdated", 2); 1487 1488 this.nodeId = nodeId; 1489 this.isScrollable = isScrollable; 1490 1491 this.isPresent = (isPresent == null) 1492 ? singleton.generateIsPresentList(this) 1493 : THROWS.check(isPresent, 2, "DOM.scrollableFlagUpdated"); 1494 } 1495 1496 /** Creates an instance of this class from a {@link JsonObject}.*/ 1497 public static scrollableFlagUpdated fromJSON(JsonObject jo) 1498 { return singleton.fromJSON(jo); } 1499 1500 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 1501 public static NestedDescriptor<scrollableFlagUpdated> descriptor() 1502 { return singleton.descriptor(); } 1503 } 1504 1505 /** 1506 * Fired when backend wants to provide client with the missing DOM structure. This happens upon 1507 * most of the calls requesting node ids. 1508 * 1509 * <EMBED CLASS=globalDefs DATA-DOMAIN=DOM DATA-API=BrowserAPI> 1510 */ 1511 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_EVENT_JDHBI") 1512 public static class setChildNodes 1513 extends BrowserEvent<setChildNodes> 1514 implements java.io.Serializable 1515 { 1516 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 1517 protected static final long serialVersionUID = 1; 1518 1519 private static final NestedHelper<DOM.setChildNodes> singleton = 1520 Torello.Browser.BrowserAPI.NestedHelpers.Events. 1521 DOM$$setChildNodes$$.singleton; 1522 1523 /** Parent node id to populate with children. */ 1524 public final int parentId; 1525 1526 /** Child nodes array. */ 1527 public final DOM.Node[] nodes; 1528 1529 /** Constructor. Please review this class' fields for documentation. */ 1530 public setChildNodes(ReadOnlyList<Boolean> isPresent, int parentId, Node[] nodes) 1531 { 1532 super(singleton, Domains.DOM, "setChildNodes", 2); 1533 1534 this.parentId = parentId; 1535 this.nodes = nodes; 1536 1537 this.isPresent = (isPresent == null) 1538 ? singleton.generateIsPresentList(this) 1539 : THROWS.check(isPresent, 2, "DOM.setChildNodes"); 1540 } 1541 1542 /** Creates an instance of this class from a {@link JsonObject}.*/ 1543 public static setChildNodes fromJSON(JsonObject jo) 1544 { return singleton.fromJSON(jo); } 1545 1546 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 1547 public static NestedDescriptor<setChildNodes> descriptor() 1548 { return singleton.descriptor(); } 1549 } 1550 1551 /** 1552 * Called when shadow root is popped from the element. 1553 * 1554 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 1555 * <EMBED CLASS=globalDefs DATA-DOMAIN=DOM DATA-API=BrowserAPI> 1556 */ 1557 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_EVENT_JDHBI") 1558 public static class shadowRootPopped 1559 extends BrowserEvent<shadowRootPopped> 1560 implements java.io.Serializable 1561 { 1562 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 1563 protected static final long serialVersionUID = 1; 1564 1565 private static final NestedHelper<DOM.shadowRootPopped> singleton = 1566 Torello.Browser.BrowserAPI.NestedHelpers.Events. 1567 DOM$$shadowRootPopped$$.singleton; 1568 1569 /** Host element id. */ 1570 public final int hostId; 1571 1572 /** Shadow root id. */ 1573 public final int rootId; 1574 1575 /** Constructor. Please review this class' fields for documentation. */ 1576 public shadowRootPopped(ReadOnlyList<Boolean> isPresent, int hostId, int rootId) 1577 { 1578 super(singleton, Domains.DOM, "shadowRootPopped", 2); 1579 1580 this.hostId = hostId; 1581 this.rootId = rootId; 1582 1583 this.isPresent = (isPresent == null) 1584 ? singleton.generateIsPresentList(this) 1585 : THROWS.check(isPresent, 2, "DOM.shadowRootPopped"); 1586 } 1587 1588 /** Creates an instance of this class from a {@link JsonObject}.*/ 1589 public static shadowRootPopped fromJSON(JsonObject jo) 1590 { return singleton.fromJSON(jo); } 1591 1592 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 1593 public static NestedDescriptor<shadowRootPopped> descriptor() 1594 { return singleton.descriptor(); } 1595 } 1596 1597 /** 1598 * Called when shadow root is pushed into the element. 1599 * 1600 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 1601 * <EMBED CLASS=globalDefs DATA-DOMAIN=DOM DATA-API=BrowserAPI> 1602 */ 1603 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_EVENT_JDHBI") 1604 public static class shadowRootPushed 1605 extends BrowserEvent<shadowRootPushed> 1606 implements java.io.Serializable 1607 { 1608 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 1609 protected static final long serialVersionUID = 1; 1610 1611 private static final NestedHelper<DOM.shadowRootPushed> singleton = 1612 Torello.Browser.BrowserAPI.NestedHelpers.Events. 1613 DOM$$shadowRootPushed$$.singleton; 1614 1615 /** Host element id. */ 1616 public final int hostId; 1617 1618 /** Shadow root. */ 1619 public final DOM.Node root; 1620 1621 /** Constructor. Please review this class' fields for documentation. */ 1622 public shadowRootPushed(ReadOnlyList<Boolean> isPresent, int hostId, Node root) 1623 { 1624 super(singleton, Domains.DOM, "shadowRootPushed", 2); 1625 1626 this.hostId = hostId; 1627 this.root = root; 1628 1629 this.isPresent = (isPresent == null) 1630 ? singleton.generateIsPresentList(this) 1631 : THROWS.check(isPresent, 2, "DOM.shadowRootPushed"); 1632 } 1633 1634 /** Creates an instance of this class from a {@link JsonObject}.*/ 1635 public static shadowRootPushed fromJSON(JsonObject jo) 1636 { return singleton.fromJSON(jo); } 1637 1638 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 1639 public static NestedDescriptor<shadowRootPushed> descriptor() 1640 { return singleton.descriptor(); } 1641 } 1642 1643 1644 1645 1646 // ******************************************************************************************** 1647 // ******************************************************************************************** 1648 // Commands 1649 // ******************************************************************************************** 1650 // ******************************************************************************************** 1651 1652 1653 /** 1654 * Collects class names for the node with given id and all of it's child nodes. 1655 * 1656 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 1657 * 1658 * @param nodeId Id of the node to collect class names. 1659 * 1660 * @return An instance of <CODE>{@link Script}<String[]></CODE> 1661 * 1662 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 1663 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 1664 * <CODE><String[]></CODE> will be returned 1665 * 1666 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 1667 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 1668 * be retrieved.</I> 1669 * 1670 * <BR /><BR /><DIV CLASS=JDHint> 1671 * This Browser Function's {@code Promise} returns: 1672 * <CODE>String[] (<B>classNames</B>)</CODE> 1673 * <BR /> 1674 * Class name list. 1675 * </DIV> 1676 */ 1677 public static Script<String[]> collectClassNamesFromSubtree(int nodeId) 1678 { 1679 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 1680 final String requestJSON = WriteJSON.get 1681 (CDPTypes.PRIMITIVE_INT, "nodeId", false, "DOM.collectClassNamesFromSubtree", nodeId); 1682 1683 return new Script<>( 1684 Domains.DOM, "collectClassNamesFromSubtree", requestJSON, 1685 DOM$$Commands::collectClassNamesFromSubtree, 1686 String[].class 1687 ); 1688 } 1689 1690 /** 1691 * Creates a deep copy of the specified node and places it into the target container before the 1692 * given anchor. 1693 * 1694 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 1695 * 1696 * @param nodeId Id of the node to copy. 1697 * 1698 * @param targetNodeId Id of the element to drop the copy into. 1699 * 1700 * @param insertBeforeNodeId 1701 * Drop the copy before this node (if absent, the copy becomes the last child of 1702 * <CODE>targetNodeId</CODE>). 1703 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 1704 * 1705 * @return An instance of <CODE>{@link Script}<Integer></CODE> 1706 * 1707 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 1708 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 1709 * <CODE><Integer></CODE> will be returned 1710 * 1711 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 1712 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 1713 * be retrieved.</I> 1714 * 1715 * <BR /><BR /><DIV CLASS=JDHint> 1716 * This Browser Function's {@code Promise} returns: 1717 * <CODE>Integer (<B>nodeId</B>)</CODE> 1718 * <BR /> 1719 * Id of the node clone. 1720 * </DIV> 1721 */ 1722 public static Script<Integer> copyTo(int nodeId, int targetNodeId, Integer insertBeforeNodeId) 1723 { 1724 // Convert all Method Parameters into a JSON Request-Object (as a String) 1725 final String requestJSON = WriteJSON.get( 1726 DOM$$Commands.copyTo$$, "DOM.copyTo", 1727 nodeId, targetNodeId, insertBeforeNodeId 1728 ); 1729 1730 return new Script<>( 1731 Domains.DOM, "copyTo", requestJSON, 1732 jo -> ReadBoxedJSON.getInteger(jo, "nodeId", JFlag.RD_N | JFlag.RD_M, DV.NULL_INT), 1733 Integer.class 1734 ); 1735 } 1736 1737 /** 1738 * Describes node given its id, does not require domain to be enabled. Does not start tracking any 1739 * objects, can be used for automation. 1740 * 1741 * <BR /><BR /><DIV CLASS=JDHint> 1742 * 👍 Because of the sheer number of input parameters to this method, there is a 1743 * a {@link CommandBuilder} variant to this method which may be invoked instead. 1744 * 1745 * <BR /><BR /> 1746 * Please View: {@link #describeNode()} 1747 * </DIV> 1748 * 1749 * @param nodeId Identifier of the node. 1750 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 1751 * 1752 * @param backendNodeId Identifier of the backend node. 1753 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 1754 * 1755 * @param objectId JavaScript object id of the node wrapper. 1756 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 1757 * 1758 * @param depth 1759 * The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the 1760 * entire subtree or provide an integer larger than 0. 1761 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 1762 * 1763 * @param pierce 1764 * Whether or not iframes and shadow roots should be traversed when returning the subtree 1765 * (default is false). 1766 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 1767 * 1768 * @return An instance of <CODE>{@link Script}<{@link DOM.Node}></CODE> 1769 * 1770 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 1771 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 1772 * <CODE><{@link DOM.Node}></CODE> will be returned 1773 * 1774 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 1775 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 1776 * be retrieved.</I> 1777 * 1778 * <BR /><BR /><DIV CLASS=JDHint> 1779 * This Browser Function's {@code Promise} returns: 1780 * <CODE>{@link DOM.Node} (<B>node</B>)</CODE> 1781 * <BR /> 1782 * Node description. 1783 * </DIV> 1784 */ 1785 public static Script<DOM.Node> describeNode 1786 (Integer nodeId, Integer backendNodeId, String objectId, Integer depth, Boolean pierce) 1787 { 1788 // Convert all Method Parameters into a JSON Request-Object (as a String) 1789 final String requestJSON = WriteJSON.get( 1790 DOM$$Commands.describeNode$$, "DOM.describeNode", 1791 nodeId, backendNodeId, objectId, depth, pierce 1792 ); 1793 1794 return new Script<>( 1795 Domains.DOM, "describeNode", requestJSON, 1796 DOM$$Commands::describeNode, 1797 DOM.Node.class 1798 ); 1799 } 1800 1801 /** 1802 * Disables DOM agent for the given page. 1803 * 1804 * @return An instance of <CODE>{@link Script}<Void></CODE> 1805 * 1806 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1807 * browser receives the invocation-request. 1808 * 1809 * <BR /><BR /><DIV CLASS=JDHint> 1810 * This Browser-Function <I>does not have</I> a return-value. You may choose to 1811 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 1812 * the Browser Function has run to completion. 1813 * </DIV> 1814 */ 1815 public static Script<Void> disable() 1816 { 1817 // Ultra-Simple Request JSON - Because this method has no parameters 1818 final String requestJSON = "{\"method\":\"DOM.disable\"}"; 1819 1820 return Script.NO_RET(Domains.DOM, "disable", requestJSON); 1821 } 1822 1823 /** 1824 * Discards search results from the session with the given id. <CODE>getSearchResults</CODE> should no longer 1825 * be called for that search. 1826 * 1827 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 1828 * 1829 * @param searchId Unique search session identifier. 1830 * 1831 * @return An instance of <CODE>{@link Script}<Void></CODE> 1832 * 1833 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1834 * browser receives the invocation-request. 1835 * 1836 * <BR /><BR /><DIV CLASS=JDHint> 1837 * This Browser-Function <I>does not have</I> a return-value. You may choose to 1838 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 1839 * the Browser Function has run to completion. 1840 * </DIV> 1841 */ 1842 public static Script<Void> discardSearchResults(String searchId) 1843 { 1844 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 1845 final String requestJSON = WriteJSON.get 1846 (CDPTypes.STRING, "searchId", false, "DOM.discardSearchResults", searchId); 1847 1848 return Script.NO_RET(Domains.DOM, "discardSearchResults", requestJSON); 1849 } 1850 1851 /** 1852 * Enables DOM agent for the given page. 1853 * 1854 * @param includeWhitespace Whether to include whitespaces in the children array of returned Nodes. 1855 * <BR />Acceptable Values: ["all", "none"] 1856 * <BR /><B CLASS=Opt-Top>OPTIONAL</B><B CLASS=Exp-Top>EXPERIMENTAL</B> 1857 * 1858 * @return An instance of <CODE>{@link Script}<Void></CODE> 1859 * 1860 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1861 * browser receives the invocation-request. 1862 * 1863 * <BR /><BR /><DIV CLASS=JDHint> 1864 * This Browser-Function <I>does not have</I> a return-value. You may choose to 1865 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 1866 * the Browser Function has run to completion. 1867 * </DIV> 1868 */ 1869 public static Script<Void> enable(String includeWhitespace) 1870 { 1871 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 1872 final String requestJSON = WriteJSON.get 1873 (CDPTypes.STRING, "includeWhitespace", true, "DOM.enable", includeWhitespace); 1874 1875 return Script.NO_RET(Domains.DOM, "enable", requestJSON); 1876 } 1877 1878 /** 1879 * Focuses the given element. 1880 * 1881 * @param nodeId Identifier of the node. 1882 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 1883 * 1884 * @param backendNodeId Identifier of the backend node. 1885 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 1886 * 1887 * @param objectId JavaScript object id of the node wrapper. 1888 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 1889 * 1890 * @return An instance of <CODE>{@link Script}<Void></CODE> 1891 * 1892 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1893 * browser receives the invocation-request. 1894 * 1895 * <BR /><BR /><DIV CLASS=JDHint> 1896 * This Browser-Function <I>does not have</I> a return-value. You may choose to 1897 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 1898 * the Browser Function has run to completion. 1899 * </DIV> 1900 */ 1901 public static Script<Void> focus(Integer nodeId, Integer backendNodeId, String objectId) 1902 { 1903 // Convert all Method Parameters into a JSON Request-Object (as a String) 1904 final String requestJSON = WriteJSON.get( 1905 DOM$$Commands.focus$$, "DOM.focus", 1906 nodeId, backendNodeId, objectId 1907 ); 1908 1909 return Script.NO_RET(Domains.DOM, "focus", requestJSON); 1910 } 1911 1912 /** 1913 * When enabling, this API force-opens the popover identified by nodeId 1914 * and keeps it open until disabled. 1915 * 1916 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 1917 * 1918 * @param nodeId Id of the popover HTMLElement 1919 * 1920 * @param enable 1921 * If true, opens the popover and keeps it open. If false, closes the 1922 * popover if it was previously force-opened. 1923 * 1924 * @return An instance of <CODE>{@link Script}<int[]></CODE> 1925 * 1926 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 1927 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 1928 * <CODE><int[]></CODE> will be returned 1929 * 1930 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 1931 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 1932 * be retrieved.</I> 1933 * 1934 * <BR /><BR /><DIV CLASS=JDHint> 1935 * This Browser Function's {@code Promise} returns: 1936 * <CODE>int[] (<B>nodeIds</B>)</CODE> 1937 * <BR /> 1938 * List of popovers that were closed in order to respect popover stacking order. 1939 * </DIV> 1940 */ 1941 public static Script<int[]> forceShowPopover(int nodeId, boolean enable) 1942 { 1943 // Convert all Method Parameters into a JSON Request-Object (as a String) 1944 final String requestJSON = WriteJSON.get( 1945 DOM$$Commands.forceShowPopover$$, "DOM.forceShowPopover", 1946 nodeId, enable 1947 ); 1948 1949 return new Script<>( 1950 Domains.DOM, "forceShowPopover", requestJSON, 1951 DOM$$Commands::forceShowPopover, 1952 int[].class 1953 ); 1954 } 1955 1956 /** 1957 * Returns the target anchor element of the given anchor query according to 1958 * https://www.w3.org/TR/css-anchor-position-1/#target. 1959 * 1960 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 1961 * 1962 * @param nodeId Id of the positioned element from which to find the anchor. 1963 * 1964 * @param anchorSpecifier 1965 * An optional anchor specifier, as defined in 1966 * https://www.w3.org/TR/css-anchor-position-1/#anchor-specifier. 1967 * If not provided, it will return the implicit anchor element for 1968 * the given positioned element. 1969 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 1970 * 1971 * @return An instance of <CODE>{@link Script}<Integer></CODE> 1972 * 1973 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 1974 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 1975 * <CODE><Integer></CODE> will be returned 1976 * 1977 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 1978 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 1979 * be retrieved.</I> 1980 * 1981 * <BR /><BR /><DIV CLASS=JDHint> 1982 * This Browser Function's {@code Promise} returns: 1983 * <CODE>Integer (<B>nodeId</B>)</CODE> 1984 * <BR /> 1985 * The anchor element of the given anchor query. 1986 * </DIV> 1987 */ 1988 public static Script<Integer> getAnchorElement(int nodeId, String anchorSpecifier) 1989 { 1990 // Convert all Method Parameters into a JSON Request-Object (as a String) 1991 final String requestJSON = WriteJSON.get( 1992 DOM$$Commands.getAnchorElement$$, "DOM.getAnchorElement", 1993 nodeId, anchorSpecifier 1994 ); 1995 1996 return new Script<>( 1997 Domains.DOM, "getAnchorElement", requestJSON, 1998 jo -> ReadBoxedJSON.getInteger(jo, "nodeId", JFlag.RD_N | JFlag.RD_M, DV.NULL_INT), 1999 Integer.class 2000 ); 2001 } 2002 2003 /** 2004 * Returns attributes for the specified node. 2005 * 2006 * @param nodeId Id of the node to retrieve attributes for. 2007 * 2008 * @return An instance of <CODE>{@link Script}<String[]></CODE> 2009 * 2010 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 2011 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 2012 * <CODE><String[]></CODE> will be returned 2013 * 2014 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 2015 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 2016 * be retrieved.</I> 2017 * 2018 * <BR /><BR /><DIV CLASS=JDHint> 2019 * This Browser Function's {@code Promise} returns: 2020 * <CODE>String[] (<B>attributes</B>)</CODE> 2021 * <BR /> 2022 * An interleaved array of node attribute names and values. 2023 * </DIV> 2024 */ 2025 public static Script<String[]> getAttributes(int nodeId) 2026 { 2027 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 2028 final String requestJSON = WriteJSON.get 2029 (CDPTypes.PRIMITIVE_INT, "nodeId", false, "DOM.getAttributes", nodeId); 2030 2031 return new Script<>( 2032 Domains.DOM, "getAttributes", requestJSON, 2033 DOM$$Commands::getAttributes, 2034 String[].class 2035 ); 2036 } 2037 2038 /** 2039 * Returns boxes for the given node. 2040 * 2041 * @param nodeId Identifier of the node. 2042 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 2043 * 2044 * @param backendNodeId Identifier of the backend node. 2045 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 2046 * 2047 * @param objectId JavaScript object id of the node wrapper. 2048 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 2049 * 2050 * @return An instance of <CODE>{@link Script}<{@link DOM.BoxModel}></CODE> 2051 * 2052 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 2053 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 2054 * <CODE><{@link DOM.BoxModel}></CODE> will be returned 2055 * 2056 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 2057 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 2058 * be retrieved.</I> 2059 * 2060 * <BR /><BR /><DIV CLASS=JDHint> 2061 * This Browser Function's {@code Promise} returns: 2062 * <CODE>{@link DOM.BoxModel} (<B>model</B>)</CODE> 2063 * <BR /> 2064 * Box model for the node. 2065 * </DIV> 2066 */ 2067 public static Script<DOM.BoxModel> getBoxModel 2068 (Integer nodeId, Integer backendNodeId, String objectId) 2069 { 2070 // Convert all Method Parameters into a JSON Request-Object (as a String) 2071 final String requestJSON = WriteJSON.get( 2072 DOM$$Commands.getBoxModel$$, "DOM.getBoxModel", 2073 nodeId, backendNodeId, objectId 2074 ); 2075 2076 return new Script<>( 2077 Domains.DOM, "getBoxModel", requestJSON, 2078 DOM$$Commands::getBoxModel, 2079 DOM.BoxModel.class 2080 ); 2081 } 2082 2083 /** 2084 * Returns the query container of the given node based on container query 2085 * conditions: containerName, physical and logical axes, and whether it queries 2086 * scroll-state or anchored elements. If no axes are provided and 2087 * queriesScrollState is false, the style container is returned, which is the 2088 * direct parent or the closest element with a matching container-name. 2089 * 2090 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 2091 * 2092 * <BR /><BR /><DIV CLASS=JDHint> 2093 * 👍 Because of the sheer number of input parameters to this method, there is a 2094 * a {@link CommandBuilder} variant to this method which may be invoked instead. 2095 * 2096 * <BR /><BR /> 2097 * Please View: {@link #getContainerForNode()} 2098 * </DIV> 2099 * 2100 * @param nodeId - 2101 * 2102 * @param containerName - 2103 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 2104 * 2105 * @param physicalAxes - 2106 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 2107 * 2108 * @param logicalAxes - 2109 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 2110 * 2111 * @param queriesScrollState - 2112 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 2113 * 2114 * @param queriesAnchored - 2115 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 2116 * 2117 * @return An instance of <CODE>{@link Script}<Integer></CODE> 2118 * 2119 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 2120 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 2121 * <CODE><Integer></CODE> will be returned 2122 * 2123 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 2124 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 2125 * be retrieved.</I> 2126 * 2127 * <BR /><BR /><DIV CLASS=JDHint> 2128 * This Browser Function's {@code Promise} returns: 2129 * <CODE>Integer (<B>nodeId</B>)</CODE> 2130 * <BR /> 2131 * The container node for the given node, or null if not found. 2132 * </DIV> 2133 */ 2134 public static Script<Integer> getContainerForNode( 2135 int nodeId, String containerName, String physicalAxes, String logicalAxes, 2136 Boolean queriesScrollState, Boolean queriesAnchored 2137 ) 2138 { 2139 // Convert all Method Parameters into a JSON Request-Object (as a String) 2140 final String requestJSON = WriteJSON.get( 2141 DOM$$Commands.getContainerForNode$$, "DOM.getContainerForNode", 2142 nodeId, containerName, physicalAxes, logicalAxes, queriesScrollState, queriesAnchored 2143 ); 2144 2145 return new Script<>( 2146 Domains.DOM, "getContainerForNode", requestJSON, 2147 jo -> ReadBoxedJSON.getInteger(jo, "nodeId", true), 2148 Integer.class 2149 ); 2150 } 2151 2152 /** 2153 * Returns quads that describe node position on the page. This method 2154 * might return multiple quads for inline nodes. 2155 * 2156 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 2157 * 2158 * @param nodeId Identifier of the node. 2159 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 2160 * 2161 * @param backendNodeId Identifier of the backend node. 2162 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 2163 * 2164 * @param objectId JavaScript object id of the node wrapper. 2165 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 2166 * 2167 * @return An instance of <CODE>{@link Script}<Number[]></CODE> 2168 * 2169 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 2170 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 2171 * <CODE><Number[]></CODE> will be returned 2172 * 2173 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 2174 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 2175 * be retrieved.</I> 2176 * 2177 * <BR /><BR /><DIV CLASS=JDHint> 2178 * This Browser Function's {@code Promise} returns: 2179 * <CODE>Number[] (<B>quads</B>)</CODE> 2180 * <BR /> 2181 * Quads that describe node layout relative to viewport. 2182 * </DIV> 2183 */ 2184 public static Script<Number[]> getContentQuads 2185 (Integer nodeId, Integer backendNodeId, String objectId) 2186 { 2187 // Convert all Method Parameters into a JSON Request-Object (as a String) 2188 final String requestJSON = WriteJSON.get( 2189 DOM$$Commands.getContentQuads$$, "DOM.getContentQuads", 2190 nodeId, backendNodeId, objectId 2191 ); 2192 2193 return new Script<>( 2194 Domains.DOM, "getContentQuads", requestJSON, 2195 DOM$$Commands::getContentQuads, 2196 Number[].class 2197 ); 2198 } 2199 2200 /** 2201 * Returns list of detached nodes 2202 * 2203 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 2204 * 2205 * @return An instance of <CODE>{@link Script}<{@link DOM.DetachedElementInfo}[]></CODE> 2206 * 2207 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 2208 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 2209 * <CODE><{@link DOM.DetachedElementInfo}[]></CODE> will be returned 2210 * 2211 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 2212 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 2213 * be retrieved.</I> 2214 * 2215 * <BR /><BR /><DIV CLASS=JDHint> 2216 * This Browser Function's {@code Promise} returns: 2217 * <CODE>{@link DOM.DetachedElementInfo}[] (<B>detachedNodes</B>)</CODE> 2218 * <BR /> 2219 * The list of detached nodes 2220 * </DIV> 2221 */ 2222 public static Script<DOM.DetachedElementInfo[]> getDetachedDomNodes() 2223 { 2224 // Ultra-Simple Request JSON - Because this method has no parameters 2225 final String requestJSON = "{\"method\":\"DOM.getDetachedDomNodes\"}"; 2226 2227 return new Script<>( 2228 Domains.DOM, "getDetachedDomNodes", requestJSON, 2229 DOM$$Commands::getDetachedDomNodes, 2230 DOM.DetachedElementInfo[].class 2231 ); 2232 } 2233 2234 /** 2235 * Returns the root DOM node (and optionally the subtree) to the caller. 2236 * Implicitly enables the DOM domain events for the current target. 2237 * 2238 * @param depth 2239 * The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the 2240 * entire subtree or provide an integer larger than 0. 2241 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 2242 * 2243 * @param pierce 2244 * Whether or not iframes and shadow roots should be traversed when returning the subtree 2245 * (default is false). 2246 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 2247 * 2248 * @return An instance of <CODE>{@link Script}<{@link DOM.Node}></CODE> 2249 * 2250 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 2251 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 2252 * <CODE><{@link DOM.Node}></CODE> will be returned 2253 * 2254 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 2255 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 2256 * be retrieved.</I> 2257 * 2258 * <BR /><BR /><DIV CLASS=JDHint> 2259 * This Browser Function's {@code Promise} returns: 2260 * <CODE>{@link DOM.Node} (<B>root</B>)</CODE> 2261 * <BR /> 2262 * Resulting node. 2263 * </DIV> 2264 */ 2265 public static Script<DOM.Node> getDocument(Integer depth, Boolean pierce) 2266 { 2267 // Convert all Method Parameters into a JSON Request-Object (as a String) 2268 final String requestJSON = WriteJSON.get( 2269 DOM$$Commands.getDocument$$, "DOM.getDocument", 2270 depth, pierce 2271 ); 2272 2273 return new Script<>( 2274 Domains.DOM, "getDocument", requestJSON, 2275 DOM$$Commands::getDocument, 2276 DOM.Node.class 2277 ); 2278 } 2279 2280 /** 2281 * Returns the NodeId of the matched element according to certain relations. 2282 * 2283 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 2284 * 2285 * @param nodeId Id of the node from which to query the relation. 2286 * 2287 * @param relation Type of relation to get. 2288 * <BR />Acceptable Values: ["CommandFor", "InterestTarget", "PopoverTarget"] 2289 * 2290 * @return An instance of <CODE>{@link Script}<Integer></CODE> 2291 * 2292 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 2293 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 2294 * <CODE><Integer></CODE> will be returned 2295 * 2296 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 2297 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 2298 * be retrieved.</I> 2299 * 2300 * <BR /><BR /><DIV CLASS=JDHint> 2301 * This Browser Function's {@code Promise} returns: 2302 * <CODE>Integer (<B>nodeId</B>)</CODE> 2303 * <BR /> 2304 * NodeId of the element matching the queried relation. 2305 * </DIV> 2306 */ 2307 public static Script<Integer> getElementByRelation(int nodeId, String relation) 2308 { 2309 // Convert all Method Parameters into a JSON Request-Object (as a String) 2310 final String requestJSON = WriteJSON.get( 2311 DOM$$Commands.getElementByRelation$$, "DOM.getElementByRelation", 2312 nodeId, relation 2313 ); 2314 2315 return new Script<>( 2316 Domains.DOM, "getElementByRelation", requestJSON, 2317 jo -> ReadBoxedJSON.getInteger(jo, "nodeId", JFlag.RD_N | JFlag.RD_M, DV.NULL_INT), 2318 Integer.class 2319 ); 2320 } 2321 2322 /** 2323 * Returns file information for the given 2324 * File wrapper. 2325 * 2326 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 2327 * 2328 * @param objectId JavaScript object id of the node wrapper. 2329 * 2330 * @return An instance of <CODE>{@link Script}<String></CODE> 2331 * 2332 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 2333 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 2334 * <CODE><String></CODE> will be returned 2335 * 2336 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 2337 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 2338 * be retrieved.</I> 2339 * 2340 * <BR /><BR /><DIV CLASS=JDHint> 2341 * This Browser Function's {@code Promise} returns: 2342 * <CODE>String (<B>path</B>)</CODE> 2343 * </DIV> 2344 */ 2345 public static Script<String> getFileInfo(String objectId) 2346 { 2347 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 2348 final String requestJSON = WriteJSON.get 2349 (CDPTypes.STRING, "objectId", false, "DOM.getFileInfo", objectId); 2350 2351 return new Script<>( 2352 Domains.DOM, "getFileInfo", requestJSON, 2353 jo -> ReadJSON.getString(jo, "path", true, false), 2354 String.class 2355 ); 2356 } 2357 2358 /** 2359 * Returns the root DOM node (and optionally the subtree) to the caller. 2360 * Deprecated, as it is not designed to work well with the rest of the DOM agent. 2361 * Use DOMSnapshot.captureSnapshot instead. 2362 * 2363 * <BR /><B CLASS=Dep-Top>DEPRECATED</B> 2364 * 2365 * @param depth 2366 * The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the 2367 * entire subtree or provide an integer larger than 0. 2368 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 2369 * 2370 * @param pierce 2371 * Whether or not iframes and shadow roots should be traversed when returning the subtree 2372 * (default is false). 2373 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 2374 * 2375 * @return An instance of <CODE>{@link Script}<{@link DOM.Node}[]></CODE> 2376 * 2377 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 2378 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 2379 * <CODE><{@link DOM.Node}[]></CODE> will be returned 2380 * 2381 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 2382 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 2383 * be retrieved.</I> 2384 * 2385 * <BR /><BR /><DIV CLASS=JDHint> 2386 * This Browser Function's {@code Promise} returns: 2387 * <CODE>{@link DOM.Node}[] (<B>nodes</B>)</CODE> 2388 * <BR /> 2389 * Resulting node. 2390 * </DIV> 2391 */ 2392 public static Script<DOM.Node[]> getFlattenedDocument(Integer depth, Boolean pierce) 2393 { 2394 // Convert all Method Parameters into a JSON Request-Object (as a String) 2395 final String requestJSON = WriteJSON.get( 2396 DOM$$Commands.getFlattenedDocument$$, "DOM.getFlattenedDocument", 2397 depth, pierce 2398 ); 2399 2400 return new Script<>( 2401 Domains.DOM, "getFlattenedDocument", requestJSON, 2402 DOM$$Commands::getFlattenedDocument, 2403 DOM.Node[].class 2404 ); 2405 } 2406 2407 /** 2408 * Returns iframe node that owns iframe with the given domain. 2409 * 2410 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 2411 * 2412 * @param frameId - 2413 * 2414 * @return An instance of <CODE>{@link Script}<{@link getFrameOwner$$RET}></CODE> 2415 * 2416 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 2417 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 2418 * <CODE><{@link getFrameOwner$$RET}></CODE> will be returned 2419 * 2420 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 2421 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 2422 * be retrieved.</I> 2423 * 2424 * <BR /><BR /><DIV CLASS=JDHint> 2425 * This Browser Function's {@code Promise} returns:{@link getFrameOwner$$RET} 2426 * A dedicated return type implies that the browser may return more than 1 datum 2427 * </DIV> 2428 */ 2429 public static Script<getFrameOwner$$RET> getFrameOwner(String frameId) 2430 { 2431 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 2432 final String requestJSON = WriteJSON.get 2433 (CDPTypes.STRING, "frameId", false, "DOM.getFrameOwner", frameId); 2434 2435 return new Script<>( 2436 Domains.DOM, "getFrameOwner", requestJSON, 2437 getFrameOwner$$RET::fromJSON, 2438 getFrameOwner$$RET.class 2439 ); 2440 } 2441 2442 /** 2443 * Returns node id at given location. Depending on whether DOM domain is enabled, nodeId is 2444 * either returned or not. 2445 * 2446 * @param x X coordinate. 2447 * 2448 * @param y Y coordinate. 2449 * 2450 * @param includeUserAgentShadowDOM False to skip to the nearest non-UA shadow root ancestor (default: false). 2451 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 2452 * 2453 * @param ignorePointerEventsNone Whether to ignore pointer-events: none on elements and hit test them. 2454 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 2455 * 2456 * @return An instance of <CODE>{@link Script}<{@link getNodeForLocation$$RET}></CODE> 2457 * 2458 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 2459 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 2460 * <CODE><{@link getNodeForLocation$$RET}></CODE> will be returned 2461 * 2462 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 2463 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 2464 * be retrieved.</I> 2465 * 2466 * <BR /><BR /><DIV CLASS=JDHint> 2467 * This Browser Function's {@code Promise} returns:{@link getNodeForLocation$$RET} 2468 * A dedicated return type implies that the browser may return more than 1 datum 2469 * </DIV> 2470 */ 2471 public static Script<getNodeForLocation$$RET> getNodeForLocation 2472 (int x, int y, Boolean includeUserAgentShadowDOM, Boolean ignorePointerEventsNone) 2473 { 2474 // Convert all Method Parameters into a JSON Request-Object (as a String) 2475 final String requestJSON = WriteJSON.get( 2476 DOM$$Commands.getNodeForLocation$$, "DOM.getNodeForLocation", 2477 x, y, includeUserAgentShadowDOM, ignorePointerEventsNone 2478 ); 2479 2480 return new Script<>( 2481 Domains.DOM, "getNodeForLocation", requestJSON, 2482 getNodeForLocation$$RET::fromJSON, 2483 getNodeForLocation$$RET.class 2484 ); 2485 } 2486 2487 /** 2488 * Gets stack traces associated with a Node. As of now, only provides stack trace for Node creation. 2489 * 2490 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 2491 * 2492 * @param nodeId Id of the node to get stack traces for. 2493 * 2494 * @return An instance of <CODE>{@link Script}<{@link RunTime.StackTrace}></CODE> 2495 * 2496 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 2497 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 2498 * <CODE><{@link RunTime.StackTrace}></CODE> will be returned 2499 * 2500 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 2501 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 2502 * be retrieved.</I> 2503 * 2504 * <BR /><BR /><DIV CLASS=JDHint> 2505 * This Browser Function's {@code Promise} returns: 2506 * <CODE>{@link RunTime.StackTrace} (<B>creation</B>)</CODE> 2507 * <BR /> 2508 * Creation stack trace, if available. 2509 * </DIV> 2510 */ 2511 public static Script<RunTime.StackTrace> getNodeStackTraces(int nodeId) 2512 { 2513 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 2514 final String requestJSON = WriteJSON.get 2515 (CDPTypes.PRIMITIVE_INT, "nodeId", false, "DOM.getNodeStackTraces", nodeId); 2516 2517 return new Script<>( 2518 Domains.DOM, "getNodeStackTraces", requestJSON, 2519 DOM$$Commands::getNodeStackTraces, 2520 RunTime.StackTrace.class 2521 ); 2522 } 2523 2524 /** 2525 * Finds nodes with a given computed style in a subtree. 2526 * 2527 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 2528 * 2529 * @param nodeId Node ID pointing to the root of a subtree. 2530 * 2531 * @param computedStyles The style to filter nodes by (includes nodes if any of properties matches). 2532 * 2533 * @param pierce 2534 * Whether or not iframes and shadow roots in the same target should be traversed when returning the 2535 * results (default is false). 2536 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 2537 * 2538 * @return An instance of <CODE>{@link Script}<int[]></CODE> 2539 * 2540 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 2541 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 2542 * <CODE><int[]></CODE> will be returned 2543 * 2544 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 2545 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 2546 * be retrieved.</I> 2547 * 2548 * <BR /><BR /><DIV CLASS=JDHint> 2549 * This Browser Function's {@code Promise} returns: 2550 * <CODE>int[] (<B>nodeIds</B>)</CODE> 2551 * <BR /> 2552 * Resulting nodes. 2553 * </DIV> 2554 */ 2555 public static Script<int[]> getNodesForSubtreeByStyle 2556 (int nodeId, CSSComputedStyleProperty[] computedStyles, Boolean pierce) 2557 { 2558 // Convert all Method Parameters into a JSON Request-Object (as a String) 2559 final String requestJSON = WriteJSON.get( 2560 DOM$$Commands.getNodesForSubtreeByStyle$$, "DOM.getNodesForSubtreeByStyle", 2561 nodeId, computedStyles, pierce 2562 ); 2563 2564 return new Script<>( 2565 Domains.DOM, "getNodesForSubtreeByStyle", requestJSON, 2566 DOM$$Commands::getNodesForSubtreeByStyle, 2567 int[].class 2568 ); 2569 } 2570 2571 /** 2572 * Returns node's HTML markup. 2573 * 2574 * @param nodeId Identifier of the node. 2575 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 2576 * 2577 * @param backendNodeId Identifier of the backend node. 2578 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 2579 * 2580 * @param objectId JavaScript object id of the node wrapper. 2581 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 2582 * 2583 * @param includeShadowDOM Include all shadow roots. Equals to false if not specified. 2584 * <BR /><B CLASS=Opt-Top>OPTIONAL</B><B CLASS=Exp-Top>EXPERIMENTAL</B> 2585 * 2586 * @return An instance of <CODE>{@link Script}<String></CODE> 2587 * 2588 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 2589 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 2590 * <CODE><String></CODE> will be returned 2591 * 2592 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 2593 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 2594 * be retrieved.</I> 2595 * 2596 * <BR /><BR /><DIV CLASS=JDHint> 2597 * This Browser Function's {@code Promise} returns: 2598 * <CODE>String (<B>outerHTML</B>)</CODE> 2599 * <BR /> 2600 * Outer HTML markup. 2601 * </DIV> 2602 */ 2603 public static Script<String> getOuterHTML 2604 (Integer nodeId, Integer backendNodeId, String objectId, Boolean includeShadowDOM) 2605 { 2606 // Convert all Method Parameters into a JSON Request-Object (as a String) 2607 final String requestJSON = WriteJSON.get( 2608 DOM$$Commands.getOuterHTML$$, "DOM.getOuterHTML", 2609 nodeId, backendNodeId, objectId, includeShadowDOM 2610 ); 2611 2612 return new Script<>( 2613 Domains.DOM, "getOuterHTML", requestJSON, 2614 jo -> ReadJSON.getString(jo, "outerHTML", true, false), 2615 String.class 2616 ); 2617 } 2618 2619 /** 2620 * Returns the descendants of a container query container that have 2621 * container queries against this container. 2622 * 2623 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 2624 * 2625 * @param nodeId Id of the container node to find querying descendants from. 2626 * 2627 * @return An instance of <CODE>{@link Script}<int[]></CODE> 2628 * 2629 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 2630 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 2631 * <CODE><int[]></CODE> will be returned 2632 * 2633 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 2634 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 2635 * be retrieved.</I> 2636 * 2637 * <BR /><BR /><DIV CLASS=JDHint> 2638 * This Browser Function's {@code Promise} returns: 2639 * <CODE>int[] (<B>nodeIds</B>)</CODE> 2640 * <BR /> 2641 * Descendant nodes with container queries against the given container. 2642 * </DIV> 2643 */ 2644 public static Script<int[]> getQueryingDescendantsForContainer(int nodeId) 2645 { 2646 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 2647 final String requestJSON = WriteJSON.get( 2648 CDPTypes.PRIMITIVE_INT, "nodeId", false, "DOM.getQueryingDescendantsForContainer", 2649 nodeId 2650 ); 2651 2652 return new Script<>( 2653 Domains.DOM, "getQueryingDescendantsForContainer", requestJSON, 2654 DOM$$Commands::getQueryingDescendantsForContainer, 2655 int[].class 2656 ); 2657 } 2658 2659 /** 2660 * Returns the id of the nearest ancestor that is a relayout boundary. 2661 * 2662 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 2663 * 2664 * @param nodeId Id of the node. 2665 * 2666 * @return An instance of <CODE>{@link Script}<Integer></CODE> 2667 * 2668 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 2669 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 2670 * <CODE><Integer></CODE> will be returned 2671 * 2672 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 2673 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 2674 * be retrieved.</I> 2675 * 2676 * <BR /><BR /><DIV CLASS=JDHint> 2677 * This Browser Function's {@code Promise} returns: 2678 * <CODE>Integer (<B>nodeId</B>)</CODE> 2679 * <BR /> 2680 * Relayout boundary node id for the given node. 2681 * </DIV> 2682 */ 2683 public static Script<Integer> getRelayoutBoundary(int nodeId) 2684 { 2685 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 2686 final String requestJSON = WriteJSON.get 2687 (CDPTypes.PRIMITIVE_INT, "nodeId", false, "DOM.getRelayoutBoundary", nodeId); 2688 2689 return new Script<>( 2690 Domains.DOM, "getRelayoutBoundary", requestJSON, 2691 jo -> ReadBoxedJSON.getInteger(jo, "nodeId", JFlag.RD_N | JFlag.RD_M, DV.NULL_INT), 2692 Integer.class 2693 ); 2694 } 2695 2696 /** 2697 * Returns search results from given <CODE>fromIndex</CODE> to given <CODE>toIndex</CODE> from the search with the given 2698 * identifier. 2699 * 2700 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 2701 * 2702 * @param searchId Unique search session identifier. 2703 * 2704 * @param fromIndex Start index of the search result to be returned. 2705 * 2706 * @param toIndex End index of the search result to be returned. 2707 * 2708 * @return An instance of <CODE>{@link Script}<int[]></CODE> 2709 * 2710 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 2711 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 2712 * <CODE><int[]></CODE> will be returned 2713 * 2714 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 2715 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 2716 * be retrieved.</I> 2717 * 2718 * <BR /><BR /><DIV CLASS=JDHint> 2719 * This Browser Function's {@code Promise} returns: 2720 * <CODE>int[] (<B>nodeIds</B>)</CODE> 2721 * <BR /> 2722 * Ids of the search result nodes. 2723 * </DIV> 2724 */ 2725 public static Script<int[]> getSearchResults(String searchId, int fromIndex, int toIndex) 2726 { 2727 // Convert all Method Parameters into a JSON Request-Object (as a String) 2728 final String requestJSON = WriteJSON.get( 2729 DOM$$Commands.getSearchResults$$, "DOM.getSearchResults", 2730 searchId, fromIndex, toIndex 2731 ); 2732 2733 return new Script<>( 2734 Domains.DOM, "getSearchResults", requestJSON, 2735 DOM$$Commands::getSearchResults, 2736 int[].class 2737 ); 2738 } 2739 2740 /** 2741 * Returns NodeIds of current top layer elements. 2742 * Top layer is rendered closest to the user within a viewport, therefore its elements always 2743 * appear on top of all other content. 2744 * 2745 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 2746 * 2747 * @return An instance of <CODE>{@link Script}<int[]></CODE> 2748 * 2749 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 2750 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 2751 * <CODE><int[]></CODE> will be returned 2752 * 2753 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 2754 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 2755 * be retrieved.</I> 2756 * 2757 * <BR /><BR /><DIV CLASS=JDHint> 2758 * This Browser Function's {@code Promise} returns: 2759 * <CODE>int[] (<B>nodeIds</B>)</CODE> 2760 * <BR /> 2761 * NodeIds of top layer elements 2762 * </DIV> 2763 */ 2764 public static Script<int[]> getTopLayerElements() 2765 { 2766 // Ultra-Simple Request JSON - Because this method has no parameters 2767 final String requestJSON = "{\"method\":\"DOM.getTopLayerElements\"}"; 2768 2769 return new Script<>( 2770 Domains.DOM, "getTopLayerElements", requestJSON, 2771 DOM$$Commands::getTopLayerElements, 2772 int[].class 2773 ); 2774 } 2775 2776 /** 2777 * Hides any highlight. 2778 * 2779 * @return An instance of <CODE>{@link Script}<Void></CODE> 2780 * 2781 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 2782 * browser receives the invocation-request. 2783 * 2784 * <BR /><BR /><DIV CLASS=JDHint> 2785 * This Browser-Function <I>does not have</I> a return-value. You may choose to 2786 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 2787 * the Browser Function has run to completion. 2788 * </DIV> 2789 */ 2790 public static Script<Void> hideHighlight() 2791 { 2792 // Ultra-Simple Request JSON - Because this method has no parameters 2793 final String requestJSON = "{\"method\":\"DOM.hideHighlight\"}"; 2794 2795 return Script.NO_RET(Domains.DOM, "hideHighlight", requestJSON); 2796 } 2797 2798 /** 2799 * Highlights DOM node. 2800 * 2801 * @return An instance of <CODE>{@link Script}<Void></CODE> 2802 * 2803 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 2804 * browser receives the invocation-request. 2805 * 2806 * <BR /><BR /><DIV CLASS=JDHint> 2807 * This Browser-Function <I>does not have</I> a return-value. You may choose to 2808 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 2809 * the Browser Function has run to completion. 2810 * </DIV> 2811 */ 2812 public static Script<Void> highlightNode() 2813 { 2814 // Ultra-Simple Request JSON - Because this method has no parameters 2815 final String requestJSON = "{\"method\":\"DOM.highlightNode\"}"; 2816 2817 return Script.NO_RET(Domains.DOM, "highlightNode", requestJSON); 2818 } 2819 2820 /** 2821 * Highlights given rectangle. 2822 * 2823 * @return An instance of <CODE>{@link Script}<Void></CODE> 2824 * 2825 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 2826 * browser receives the invocation-request. 2827 * 2828 * <BR /><BR /><DIV CLASS=JDHint> 2829 * This Browser-Function <I>does not have</I> a return-value. You may choose to 2830 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 2831 * the Browser Function has run to completion. 2832 * </DIV> 2833 */ 2834 public static Script<Void> highlightRect() 2835 { 2836 // Ultra-Simple Request JSON - Because this method has no parameters 2837 final String requestJSON = "{\"method\":\"DOM.highlightRect\"}"; 2838 2839 return Script.NO_RET(Domains.DOM, "highlightRect", requestJSON); 2840 } 2841 2842 /** 2843 * Marks last undoable state. 2844 * 2845 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 2846 * 2847 * @return An instance of <CODE>{@link Script}<Void></CODE> 2848 * 2849 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 2850 * browser receives the invocation-request. 2851 * 2852 * <BR /><BR /><DIV CLASS=JDHint> 2853 * This Browser-Function <I>does not have</I> a return-value. You may choose to 2854 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 2855 * the Browser Function has run to completion. 2856 * </DIV> 2857 */ 2858 public static Script<Void> markUndoableState() 2859 { 2860 // Ultra-Simple Request JSON - Because this method has no parameters 2861 final String requestJSON = "{\"method\":\"DOM.markUndoableState\"}"; 2862 2863 return Script.NO_RET(Domains.DOM, "markUndoableState", requestJSON); 2864 } 2865 2866 /** 2867 * Moves node into the new container, places it before the given anchor. 2868 * 2869 * @param nodeId Id of the node to move. 2870 * 2871 * @param targetNodeId Id of the element to drop the moved node into. 2872 * 2873 * @param insertBeforeNodeId 2874 * Drop node before this one (if absent, the moved node becomes the last child of 2875 * <CODE>targetNodeId</CODE>). 2876 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 2877 * 2878 * @return An instance of <CODE>{@link Script}<Integer></CODE> 2879 * 2880 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 2881 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 2882 * <CODE><Integer></CODE> will be returned 2883 * 2884 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 2885 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 2886 * be retrieved.</I> 2887 * 2888 * <BR /><BR /><DIV CLASS=JDHint> 2889 * This Browser Function's {@code Promise} returns: 2890 * <CODE>Integer (<B>nodeId</B>)</CODE> 2891 * <BR /> 2892 * New id of the moved node. 2893 * </DIV> 2894 */ 2895 public static Script<Integer> moveTo(int nodeId, int targetNodeId, Integer insertBeforeNodeId) 2896 { 2897 // Convert all Method Parameters into a JSON Request-Object (as a String) 2898 final String requestJSON = WriteJSON.get( 2899 DOM$$Commands.moveTo$$, "DOM.moveTo", 2900 nodeId, targetNodeId, insertBeforeNodeId 2901 ); 2902 2903 return new Script<>( 2904 Domains.DOM, "moveTo", requestJSON, 2905 jo -> ReadBoxedJSON.getInteger(jo, "nodeId", JFlag.RD_N | JFlag.RD_M, DV.NULL_INT), 2906 Integer.class 2907 ); 2908 } 2909 2910 /** 2911 * Searches for a given string in the DOM tree. Use <CODE>getSearchResults</CODE> to access search results or 2912 * <CODE>cancelSearch</CODE> to end this search session. 2913 * 2914 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 2915 * 2916 * @param query Plain text or query selector or XPath search query. 2917 * 2918 * @param includeUserAgentShadowDOM True to search in user agent shadow DOM. 2919 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 2920 * 2921 * @return An instance of <CODE>{@link Script}<{@link performSearch$$RET}></CODE> 2922 * 2923 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 2924 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 2925 * <CODE><{@link performSearch$$RET}></CODE> will be returned 2926 * 2927 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 2928 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 2929 * be retrieved.</I> 2930 * 2931 * <BR /><BR /><DIV CLASS=JDHint> 2932 * This Browser Function's {@code Promise} returns:{@link performSearch$$RET} 2933 * A dedicated return type implies that the browser may return more than 1 datum 2934 * </DIV> 2935 */ 2936 public static Script<performSearch$$RET> performSearch 2937 (String query, Boolean includeUserAgentShadowDOM) 2938 { 2939 // Convert all Method Parameters into a JSON Request-Object (as a String) 2940 final String requestJSON = WriteJSON.get( 2941 DOM$$Commands.performSearch$$, "DOM.performSearch", 2942 query, includeUserAgentShadowDOM 2943 ); 2944 2945 return new Script<>( 2946 Domains.DOM, "performSearch", requestJSON, 2947 performSearch$$RET::fromJSON, 2948 performSearch$$RET.class 2949 ); 2950 } 2951 2952 /** 2953 * Requests that the node is sent to the caller given its path. // FIXME, use XPath 2954 * 2955 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 2956 * 2957 * @param path Path to node in the proprietary format. 2958 * 2959 * @return An instance of <CODE>{@link Script}<Integer></CODE> 2960 * 2961 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 2962 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 2963 * <CODE><Integer></CODE> will be returned 2964 * 2965 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 2966 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 2967 * be retrieved.</I> 2968 * 2969 * <BR /><BR /><DIV CLASS=JDHint> 2970 * This Browser Function's {@code Promise} returns: 2971 * <CODE>Integer (<B>nodeId</B>)</CODE> 2972 * <BR /> 2973 * Id of the node for given path. 2974 * </DIV> 2975 */ 2976 public static Script<Integer> pushNodeByPathToFrontend(String path) 2977 { 2978 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 2979 final String requestJSON = WriteJSON.get 2980 (CDPTypes.STRING, "path", false, "DOM.pushNodeByPathToFrontend", path); 2981 2982 return new Script<>( 2983 Domains.DOM, "pushNodeByPathToFrontend", requestJSON, 2984 jo -> ReadBoxedJSON.getInteger(jo, "nodeId", JFlag.RD_N | JFlag.RD_M, DV.NULL_INT), 2985 Integer.class 2986 ); 2987 } 2988 2989 /** 2990 * Requests that a batch of nodes is sent to the caller given their backend node ids. 2991 * 2992 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 2993 * 2994 * @param backendNodeIds The array of backend node ids. 2995 * 2996 * @return An instance of <CODE>{@link Script}<int[]></CODE> 2997 * 2998 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 2999 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 3000 * <CODE><int[]></CODE> will be returned 3001 * 3002 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 3003 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 3004 * be retrieved.</I> 3005 * 3006 * <BR /><BR /><DIV CLASS=JDHint> 3007 * This Browser Function's {@code Promise} returns: 3008 * <CODE>int[] (<B>nodeIds</B>)</CODE> 3009 * <BR /> 3010 * The array of ids of pushed nodes that correspond to the backend ids specified in 3011 * backendNodeIds. 3012 * </DIV> 3013 */ 3014 public static Script<int[]> pushNodesByBackendIdsToFrontend(int[] backendNodeIds) 3015 { 3016 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 3017 final String requestJSON = WriteJSON.get( 3018 CDPTypes.INT_ARRAY_1D, "backendNodeIds", false, 3019 "DOM.pushNodesByBackendIdsToFrontend", (Object) backendNodeIds 3020 ); 3021 3022 return new Script<>( 3023 Domains.DOM, "pushNodesByBackendIdsToFrontend", requestJSON, 3024 DOM$$Commands::pushNodesByBackendIdsToFrontend, 3025 int[].class 3026 ); 3027 } 3028 3029 /** 3030 * Executes <CODE>querySelector</CODE> on a given node. 3031 * 3032 * @param nodeId Id of the node to query upon. 3033 * 3034 * @param selector Selector string. 3035 * 3036 * @return An instance of <CODE>{@link Script}<Integer></CODE> 3037 * 3038 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 3039 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 3040 * <CODE><Integer></CODE> will be returned 3041 * 3042 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 3043 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 3044 * be retrieved.</I> 3045 * 3046 * <BR /><BR /><DIV CLASS=JDHint> 3047 * This Browser Function's {@code Promise} returns: 3048 * <CODE>Integer (<B>nodeId</B>)</CODE> 3049 * <BR /> 3050 * Query selector result. 3051 * </DIV> 3052 */ 3053 public static Script<Integer> querySelector(int nodeId, String selector) 3054 { 3055 // Convert all Method Parameters into a JSON Request-Object (as a String) 3056 final String requestJSON = WriteJSON.get( 3057 DOM$$Commands.querySelector$$, "DOM.querySelector", 3058 nodeId, selector 3059 ); 3060 3061 return new Script<>( 3062 Domains.DOM, "querySelector", requestJSON, 3063 jo -> ReadBoxedJSON.getInteger(jo, "nodeId", JFlag.RD_N | JFlag.RD_M, DV.NULL_INT), 3064 Integer.class 3065 ); 3066 } 3067 3068 /** 3069 * Executes <CODE>querySelectorAll</CODE> on a given node. 3070 * 3071 * @param nodeId Id of the node to query upon. 3072 * 3073 * @param selector Selector string. 3074 * 3075 * @return An instance of <CODE>{@link Script}<int[]></CODE> 3076 * 3077 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 3078 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 3079 * <CODE><int[]></CODE> will be returned 3080 * 3081 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 3082 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 3083 * be retrieved.</I> 3084 * 3085 * <BR /><BR /><DIV CLASS=JDHint> 3086 * This Browser Function's {@code Promise} returns: 3087 * <CODE>int[] (<B>nodeIds</B>)</CODE> 3088 * <BR /> 3089 * Query selector result. 3090 * </DIV> 3091 */ 3092 public static Script<int[]> querySelectorAll(int nodeId, String selector) 3093 { 3094 // Convert all Method Parameters into a JSON Request-Object (as a String) 3095 final String requestJSON = WriteJSON.get( 3096 DOM$$Commands.querySelectorAll$$, "DOM.querySelectorAll", 3097 nodeId, selector 3098 ); 3099 3100 return new Script<>( 3101 Domains.DOM, "querySelectorAll", requestJSON, 3102 DOM$$Commands::querySelectorAll, 3103 int[].class 3104 ); 3105 } 3106 3107 /** 3108 * Re-does the last undone action. 3109 * 3110 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 3111 * 3112 * @return An instance of <CODE>{@link Script}<Void></CODE> 3113 * 3114 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 3115 * browser receives the invocation-request. 3116 * 3117 * <BR /><BR /><DIV CLASS=JDHint> 3118 * This Browser-Function <I>does not have</I> a return-value. You may choose to 3119 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 3120 * the Browser Function has run to completion. 3121 * </DIV> 3122 */ 3123 public static Script<Void> redo() 3124 { 3125 // Ultra-Simple Request JSON - Because this method has no parameters 3126 final String requestJSON = "{\"method\":\"DOM.redo\"}"; 3127 3128 return Script.NO_RET(Domains.DOM, "redo", requestJSON); 3129 } 3130 3131 /** 3132 * Removes attribute with given name from an element with given id. 3133 * 3134 * @param nodeId Id of the element to remove attribute from. 3135 * 3136 * @param name Name of the attribute to remove. 3137 * 3138 * @return An instance of <CODE>{@link Script}<Void></CODE> 3139 * 3140 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 3141 * browser receives the invocation-request. 3142 * 3143 * <BR /><BR /><DIV CLASS=JDHint> 3144 * This Browser-Function <I>does not have</I> a return-value. You may choose to 3145 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 3146 * the Browser Function has run to completion. 3147 * </DIV> 3148 */ 3149 public static Script<Void> removeAttribute(int nodeId, String name) 3150 { 3151 // Convert all Method Parameters into a JSON Request-Object (as a String) 3152 final String requestJSON = WriteJSON.get( 3153 DOM$$Commands.removeAttribute$$, "DOM.removeAttribute", 3154 nodeId, name 3155 ); 3156 3157 return Script.NO_RET(Domains.DOM, "removeAttribute", requestJSON); 3158 } 3159 3160 /** 3161 * Removes node with given id. 3162 * 3163 * @param nodeId Id of the node to remove. 3164 * 3165 * @return An instance of <CODE>{@link Script}<Void></CODE> 3166 * 3167 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 3168 * browser receives the invocation-request. 3169 * 3170 * <BR /><BR /><DIV CLASS=JDHint> 3171 * This Browser-Function <I>does not have</I> a return-value. You may choose to 3172 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 3173 * the Browser Function has run to completion. 3174 * </DIV> 3175 */ 3176 public static Script<Void> removeNode(int nodeId) 3177 { 3178 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 3179 final String requestJSON = WriteJSON.get 3180 (CDPTypes.PRIMITIVE_INT, "nodeId", false, "DOM.removeNode", nodeId); 3181 3182 return Script.NO_RET(Domains.DOM, "removeNode", requestJSON); 3183 } 3184 3185 /** 3186 * Requests that children of the node with given id are returned to the caller in form of 3187 * <CODE>setChildNodes</CODE> events where not only immediate children are retrieved, but all children down to 3188 * the specified depth. 3189 * 3190 * @param nodeId Id of the node to get children for. 3191 * 3192 * @param depth 3193 * The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the 3194 * entire subtree or provide an integer larger than 0. 3195 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 3196 * 3197 * @param pierce 3198 * Whether or not iframes and shadow roots should be traversed when returning the sub-tree 3199 * (default is false). 3200 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 3201 * 3202 * @return An instance of <CODE>{@link Script}<Void></CODE> 3203 * 3204 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 3205 * browser receives the invocation-request. 3206 * 3207 * <BR /><BR /><DIV CLASS=JDHint> 3208 * This Browser-Function <I>does not have</I> a return-value. You may choose to 3209 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 3210 * the Browser Function has run to completion. 3211 * </DIV> 3212 */ 3213 public static Script<Void> requestChildNodes(int nodeId, Integer depth, Boolean pierce) 3214 { 3215 // Convert all Method Parameters into a JSON Request-Object (as a String) 3216 final String requestJSON = WriteJSON.get( 3217 DOM$$Commands.requestChildNodes$$, "DOM.requestChildNodes", 3218 nodeId, depth, pierce 3219 ); 3220 3221 return Script.NO_RET(Domains.DOM, "requestChildNodes", requestJSON); 3222 } 3223 3224 /** 3225 * Requests that the node is sent to the caller given the JavaScript node object reference. All 3226 * nodes that form the path from the node to the root are also sent to the client as a series of 3227 * <CODE>setChildNodes</CODE> notifications. 3228 * 3229 * @param objectId JavaScript object id to convert into node. 3230 * 3231 * @return An instance of <CODE>{@link Script}<Integer></CODE> 3232 * 3233 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 3234 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 3235 * <CODE><Integer></CODE> will be returned 3236 * 3237 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 3238 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 3239 * be retrieved.</I> 3240 * 3241 * <BR /><BR /><DIV CLASS=JDHint> 3242 * This Browser Function's {@code Promise} returns: 3243 * <CODE>Integer (<B>nodeId</B>)</CODE> 3244 * <BR /> 3245 * Node id for given object. 3246 * </DIV> 3247 */ 3248 public static Script<Integer> requestNode(String objectId) 3249 { 3250 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 3251 final String requestJSON = WriteJSON.get 3252 (CDPTypes.STRING, "objectId", false, "DOM.requestNode", objectId); 3253 3254 return new Script<>( 3255 Domains.DOM, "requestNode", requestJSON, 3256 jo -> ReadBoxedJSON.getInteger(jo, "nodeId", JFlag.RD_N | JFlag.RD_M, DV.NULL_INT), 3257 Integer.class 3258 ); 3259 } 3260 3261 /** 3262 * Resolves the JavaScript node object for a given NodeId or BackendNodeId. 3263 * 3264 * @param nodeId Id of the node to resolve. 3265 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 3266 * 3267 * @param backendNodeId Backend identifier of the node to resolve. 3268 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 3269 * 3270 * @param objectGroup Symbolic group name that can be used to release multiple objects. 3271 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 3272 * 3273 * @param executionContextId Execution context in which to resolve the node. 3274 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 3275 * 3276 * @return An instance of <CODE>{@link Script}<{@link RunTime.RemoteObject}></CODE> 3277 * 3278 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 3279 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 3280 * <CODE><{@link RunTime.RemoteObject}></CODE> will be returned 3281 * 3282 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 3283 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 3284 * be retrieved.</I> 3285 * 3286 * <BR /><BR /><DIV CLASS=JDHint> 3287 * This Browser Function's {@code Promise} returns: 3288 * <CODE>{@link RunTime.RemoteObject} (<B>object</B>)</CODE> 3289 * <BR /> 3290 * JavaScript object wrapper for given node. 3291 * </DIV> 3292 */ 3293 public static Script<RunTime.RemoteObject> resolveNode 3294 (Integer nodeId, Integer backendNodeId, String objectGroup, Integer executionContextId) 3295 { 3296 // Convert all Method Parameters into a JSON Request-Object (as a String) 3297 final String requestJSON = WriteJSON.get( 3298 DOM$$Commands.resolveNode$$, "DOM.resolveNode", 3299 nodeId, backendNodeId, objectGroup, executionContextId 3300 ); 3301 3302 return new Script<>( 3303 Domains.DOM, "resolveNode", requestJSON, 3304 DOM$$Commands::resolveNode, 3305 RunTime.RemoteObject.class 3306 ); 3307 } 3308 3309 /** 3310 * Scrolls the specified rect of the given node into view if not already visible. 3311 * Note: exactly one between nodeId, backendNodeId and objectId should be passed 3312 * to identify the node. 3313 * 3314 * @param nodeId Identifier of the node. 3315 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 3316 * 3317 * @param backendNodeId Identifier of the backend node. 3318 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 3319 * 3320 * @param objectId JavaScript object id of the node wrapper. 3321 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 3322 * 3323 * @param rect 3324 * The rect to be scrolled into view, relative to the node's border box, in CSS pixels. 3325 * When omitted, center of the node will be used, similar to Element.scrollIntoView. 3326 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 3327 * 3328 * @return An instance of <CODE>{@link Script}<Void></CODE> 3329 * 3330 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 3331 * browser receives the invocation-request. 3332 * 3333 * <BR /><BR /><DIV CLASS=JDHint> 3334 * This Browser-Function <I>does not have</I> a return-value. You may choose to 3335 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 3336 * the Browser Function has run to completion. 3337 * </DIV> 3338 */ 3339 public static Script<Void> scrollIntoViewIfNeeded 3340 (Integer nodeId, Integer backendNodeId, String objectId, Rect rect) 3341 { 3342 // Convert all Method Parameters into a JSON Request-Object (as a String) 3343 final String requestJSON = WriteJSON.get( 3344 DOM$$Commands.scrollIntoViewIfNeeded$$, "DOM.scrollIntoViewIfNeeded", 3345 nodeId, backendNodeId, objectId, rect 3346 ); 3347 3348 return Script.NO_RET(Domains.DOM, "scrollIntoViewIfNeeded", requestJSON); 3349 } 3350 3351 /** 3352 * Sets attribute for an element with given id. 3353 * 3354 * @param nodeId Id of the element to set attribute for. 3355 * 3356 * @param name Attribute name. 3357 * 3358 * @param value Attribute value. 3359 * 3360 * @return An instance of <CODE>{@link Script}<Void></CODE> 3361 * 3362 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 3363 * browser receives the invocation-request. 3364 * 3365 * <BR /><BR /><DIV CLASS=JDHint> 3366 * This Browser-Function <I>does not have</I> a return-value. You may choose to 3367 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 3368 * the Browser Function has run to completion. 3369 * </DIV> 3370 */ 3371 public static Script<Void> setAttributeValue(int nodeId, String name, String value) 3372 { 3373 // Convert all Method Parameters into a JSON Request-Object (as a String) 3374 final String requestJSON = WriteJSON.get( 3375 DOM$$Commands.setAttributeValue$$, "DOM.setAttributeValue", 3376 nodeId, name, value 3377 ); 3378 3379 return Script.NO_RET(Domains.DOM, "setAttributeValue", requestJSON); 3380 } 3381 3382 /** 3383 * Sets attributes on element with given id. This method is useful when user edits some existing 3384 * attribute value and types in several attribute name/value pairs. 3385 * 3386 * @param nodeId Id of the element to set attributes for. 3387 * 3388 * @param text Text with a number of attributes. Will parse this text using HTML parser. 3389 * 3390 * @param name 3391 * Attribute name to replace with new attributes derived from text in case text parsed 3392 * successfully. 3393 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 3394 * 3395 * @return An instance of <CODE>{@link Script}<Void></CODE> 3396 * 3397 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 3398 * browser receives the invocation-request. 3399 * 3400 * <BR /><BR /><DIV CLASS=JDHint> 3401 * This Browser-Function <I>does not have</I> a return-value. You may choose to 3402 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 3403 * the Browser Function has run to completion. 3404 * </DIV> 3405 */ 3406 public static Script<Void> setAttributesAsText(int nodeId, String text, String name) 3407 { 3408 // Convert all Method Parameters into a JSON Request-Object (as a String) 3409 final String requestJSON = WriteJSON.get( 3410 DOM$$Commands.setAttributesAsText$$, "DOM.setAttributesAsText", 3411 nodeId, text, name 3412 ); 3413 3414 return Script.NO_RET(Domains.DOM, "setAttributesAsText", requestJSON); 3415 } 3416 3417 /** 3418 * Sets files for the given file input element. 3419 * 3420 * @param files Array of file paths to set. 3421 * 3422 * @param nodeId Identifier of the node. 3423 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 3424 * 3425 * @param backendNodeId Identifier of the backend node. 3426 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 3427 * 3428 * @param objectId JavaScript object id of the node wrapper. 3429 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 3430 * 3431 * @return An instance of <CODE>{@link Script}<Void></CODE> 3432 * 3433 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 3434 * browser receives the invocation-request. 3435 * 3436 * <BR /><BR /><DIV CLASS=JDHint> 3437 * This Browser-Function <I>does not have</I> a return-value. You may choose to 3438 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 3439 * the Browser Function has run to completion. 3440 * </DIV> 3441 */ 3442 public static Script<Void> setFileInputFiles 3443 (String[] files, Integer nodeId, Integer backendNodeId, String objectId) 3444 { 3445 // Convert all Method Parameters into a JSON Request-Object (as a String) 3446 final String requestJSON = WriteJSON.get( 3447 DOM$$Commands.setFileInputFiles$$, "DOM.setFileInputFiles", 3448 files, nodeId, backendNodeId, objectId 3449 ); 3450 3451 return Script.NO_RET(Domains.DOM, "setFileInputFiles", requestJSON); 3452 } 3453 3454 /** 3455 * Enables console to refer to the node with given id via $x (see Command Line API for more details 3456 * $x functions). 3457 * 3458 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 3459 * 3460 * @param nodeId DOM node id to be accessible by means of $x command line API. 3461 * 3462 * @return An instance of <CODE>{@link Script}<Void></CODE> 3463 * 3464 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 3465 * browser receives the invocation-request. 3466 * 3467 * <BR /><BR /><DIV CLASS=JDHint> 3468 * This Browser-Function <I>does not have</I> a return-value. You may choose to 3469 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 3470 * the Browser Function has run to completion. 3471 * </DIV> 3472 */ 3473 public static Script<Void> setInspectedNode(int nodeId) 3474 { 3475 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 3476 final String requestJSON = WriteJSON.get 3477 (CDPTypes.PRIMITIVE_INT, "nodeId", false, "DOM.setInspectedNode", nodeId); 3478 3479 return Script.NO_RET(Domains.DOM, "setInspectedNode", requestJSON); 3480 } 3481 3482 /** 3483 * Sets node name for a node with given id. 3484 * 3485 * @param nodeId Id of the node to set name for. 3486 * 3487 * @param name New node's name. 3488 * 3489 * @return An instance of <CODE>{@link Script}<Integer></CODE> 3490 * 3491 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 3492 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 3493 * <CODE><Integer></CODE> will be returned 3494 * 3495 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 3496 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 3497 * be retrieved.</I> 3498 * 3499 * <BR /><BR /><DIV CLASS=JDHint> 3500 * This Browser Function's {@code Promise} returns: 3501 * <CODE>Integer (<B>nodeId</B>)</CODE> 3502 * <BR /> 3503 * New node's id. 3504 * </DIV> 3505 */ 3506 public static Script<Integer> setNodeName(int nodeId, String name) 3507 { 3508 // Convert all Method Parameters into a JSON Request-Object (as a String) 3509 final String requestJSON = WriteJSON.get( 3510 DOM$$Commands.setNodeName$$, "DOM.setNodeName", 3511 nodeId, name 3512 ); 3513 3514 return new Script<>( 3515 Domains.DOM, "setNodeName", requestJSON, 3516 jo -> ReadBoxedJSON.getInteger(jo, "nodeId", JFlag.RD_N | JFlag.RD_M, DV.NULL_INT), 3517 Integer.class 3518 ); 3519 } 3520 3521 /** 3522 * Sets if stack traces should be captured for Nodes. See <CODE>Node.getNodeStackTraces</CODE>. Default is disabled. 3523 * 3524 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 3525 * 3526 * @param enable Enable or disable. 3527 * 3528 * @return An instance of <CODE>{@link Script}<Void></CODE> 3529 * 3530 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 3531 * browser receives the invocation-request. 3532 * 3533 * <BR /><BR /><DIV CLASS=JDHint> 3534 * This Browser-Function <I>does not have</I> a return-value. You may choose to 3535 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 3536 * the Browser Function has run to completion. 3537 * </DIV> 3538 */ 3539 public static Script<Void> setNodeStackTracesEnabled(boolean enable) 3540 { 3541 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 3542 final String requestJSON = WriteJSON.get( 3543 CDPTypes.PRIMITIVE_BOOLEAN, "enable", false, "DOM.setNodeStackTracesEnabled", enable 3544 ); 3545 3546 return Script.NO_RET(Domains.DOM, "setNodeStackTracesEnabled", requestJSON); 3547 } 3548 3549 /** 3550 * Sets node value for a node with given id. 3551 * 3552 * @param nodeId Id of the node to set value for. 3553 * 3554 * @param value New node's value. 3555 * 3556 * @return An instance of <CODE>{@link Script}<Void></CODE> 3557 * 3558 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 3559 * browser receives the invocation-request. 3560 * 3561 * <BR /><BR /><DIV CLASS=JDHint> 3562 * This Browser-Function <I>does not have</I> a return-value. You may choose to 3563 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 3564 * the Browser Function has run to completion. 3565 * </DIV> 3566 */ 3567 public static Script<Void> setNodeValue(int nodeId, String value) 3568 { 3569 // Convert all Method Parameters into a JSON Request-Object (as a String) 3570 final String requestJSON = WriteJSON.get( 3571 DOM$$Commands.setNodeValue$$, "DOM.setNodeValue", 3572 nodeId, value 3573 ); 3574 3575 return Script.NO_RET(Domains.DOM, "setNodeValue", requestJSON); 3576 } 3577 3578 /** 3579 * Sets node HTML markup, returns new node id. 3580 * 3581 * @param nodeId Id of the node to set markup for. 3582 * 3583 * @param outerHTML Outer HTML markup to set. 3584 * 3585 * @return An instance of <CODE>{@link Script}<Void></CODE> 3586 * 3587 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 3588 * browser receives the invocation-request. 3589 * 3590 * <BR /><BR /><DIV CLASS=JDHint> 3591 * This Browser-Function <I>does not have</I> a return-value. You may choose to 3592 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 3593 * the Browser Function has run to completion. 3594 * </DIV> 3595 */ 3596 public static Script<Void> setOuterHTML(int nodeId, String outerHTML) 3597 { 3598 // Convert all Method Parameters into a JSON Request-Object (as a String) 3599 final String requestJSON = WriteJSON.get( 3600 DOM$$Commands.setOuterHTML$$, "DOM.setOuterHTML", 3601 nodeId, outerHTML 3602 ); 3603 3604 return Script.NO_RET(Domains.DOM, "setOuterHTML", requestJSON); 3605 } 3606 3607 /** 3608 * Undoes the last performed action. 3609 * 3610 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 3611 * 3612 * @return An instance of <CODE>{@link Script}<Void></CODE> 3613 * 3614 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 3615 * browser receives the invocation-request. 3616 * 3617 * <BR /><BR /><DIV CLASS=JDHint> 3618 * This Browser-Function <I>does not have</I> a return-value. You may choose to 3619 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 3620 * the Browser Function has run to completion. 3621 * </DIV> 3622 */ 3623 public static Script<Void> undo() 3624 { 3625 // Ultra-Simple Request JSON - Because this method has no parameters 3626 final String requestJSON = "{\"method\":\"DOM.undo\"}"; 3627 3628 return Script.NO_RET(Domains.DOM, "undo", requestJSON); 3629 } 3630 3631 3632 // ******************************************************************************************** 3633 // ******************************************************************************************** 3634 // CommandBuilder Getter-Methods 3635 // ******************************************************************************************** 3636 // ******************************************************************************************** 3637 3638 3639 /** 3640 * Creates a buider for conveniently assigning parameters to this method. 3641 * 3642 * <BR /><BR /><DIV CLASS=JDHint> 3643 * Note that the original method expects 5 parameters, and can be cumbersome. 3644 * </DIV> 3645 * 3646 * @return {@link CommandBuilder} instance, for assigning parameter values, one by one. 3647 * @see #describeNode 3648 */ 3649 public static CommandBuilder<DOM.Node> describeNode() 3650 { return CommandBuilder.builder(DOM$$Commands.describeNode$$); } 3651 3652 /** 3653 * Creates a buider for conveniently assigning parameters to this method. 3654 * 3655 * <BR /><BR /><DIV CLASS=JDHint> 3656 * Note that the original method expects 6 parameters, and can be cumbersome. 3657 * </DIV> 3658 * 3659 * @return {@link CommandBuilder} instance, for assigning parameter values, one by one. 3660 * @see #getContainerForNode 3661 */ 3662 public static CommandBuilder<Integer> getContainerForNode() 3663 { return CommandBuilder.builder(DOM$$Commands.getContainerForNode$$); } 3664 3665 3666}