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