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