Class Input


  • public class Input
    extends java.lang.Object
    Class created by Automatic Code-Generator.
    This class was built using the Chrome Remote Dev-Tools A.P.I., which is specified by two JSON-RPC Files. These files were obtained from the Chrome Dev Tools Protocol Git Hub Page, which has a "Tip of Tree" (the latest) API-Specification Page Here: JSON-RPC Protocol Specification.

    JSON-Viewable Google-API:
    These files may be viewed here: browser_protocol.json and js_protocol.json.
    These files were converted into this Java-Browser (CDT) Library; they are a Java-Alternative to the Node.js implementation.

    HTML-Viewable API:
    In addition to this Class-Library, these files were also converted to a simple HTML Page, which may be browsed here: Browser API Web-Page

    Node.js RDP-API Implementation:
    You may read about the Node.js Chrome Remote Interface on the Node.js Package Manager Web-Site: NPM
    [No Description Provided by Google]

    This class is intended to be used with a Headless Browser

    These methods have been tested, to some degree, using Google Chrome. In order to use this class you must start a web-browser instance and make a connection to the browser using a Remote Debugging Port. The initializations may be accomplished using class BRDPC (Browser Remote Debug Protocol Connection).

    Google-Chrome was used during the development process of the classes in this particular package. Note that, lately, it has been asserted Microsoft has switched to using the Chrome-Engine for its Microsoft Edge Browser Internal Code-Base. Therefore, there may limited support / functionality when running the methods in this class with Microsoft-Edge. There is the possibility these will work with Opera & Safari.

    Check whether the your Web-Browser will allow itself to be driven by the Web-Socket RDP-Port 9223.


    Foreign Function API:
    Every one of the methods that reside in this class are designed to do nothing more than:

    1. Accept Parameters from the User, and "Marshall Them" into a Valid JSON-Request
    2. Transmit the Marshalled Request-JSON to a Headless Web-Browser over a Web-Socket RDP Connection
    3. Receive BOTH that Method's Results AND any Browser Event-Firings from the Web-Socket
    4. Parse JSON Method-Results and Browser-Event Firings, and Subsequently Convert them to Standard Java-Types
    5. Report these Method-Results and Browser-Events to the User via an User-Registered Event-Listener or a Promise Object


    Java-HTML Difference:
    Unlike the bulk of the Java HTML JAR Library, there is very little native Java-Code, and very little testing that may be done on any of the classes & methods in this package. The code inside these classes does nothing more than marshall-and-unmarshall Java-Types into Json-Requests (and vice-versa). The Java-Script & Browser modules inside of a Google-Chrome instance are, theoretically, handling these requests, and returning their results (or events) over the Web-Socket Connection.

    It has been asserted (by Google Chrome Developers) that some of these methods are only "partially working" or "experimental".



    Stateless Class:
    This class neither contains any program-state, nor can it be instantiated. The @StaticFunctional Annotation may also be called 'The Spaghetti Report'. Static-Functional classes are, essentially, C-Styled Files, without any constructors or non-static member fields. It is a concept very similar to the Java-Bean's @Stateless Annotation.

    • 1 Constructor(s), 1 declared private, zero-argument constructor
    • 12 Method(s), 12 declared static
    • 7 Field(s), 7 declared static, 6 declared final
    • Fields excused from final modifier (with explanation):
      Field 'counter' is not final. Reason: CONFIGURATION


    • Nested Class Summary

       
      Type Classes: Input Domain Types
      Modifier and Type Inner-Class
      static class  Input.DragData
      [No Description Provided by Google]

      EXPERIMENTAL
      static class  Input.DragDataItem
      [No Description Provided by Google]

      EXPERIMENTAL
      static class  Input.TouchPoint
      [No Description Provided by Google]
       
      Event Classes: Input Domain Events
      Modifier and Type Inner-Class
      static class  Input.dragIntercepted
      Emitted only when Input.setInterceptDrags is enabled.
    • Field Summary

       
      Input Domain Enumerated String Types
      Modifier and Type Field
      static String[] GestureSourceType
      [No Description Provided by Google]

      EXPERIMENTAL
      static String[] MouseButton
      [No Description Provided by Google]
    • Method Summary

       
      Input Domain Commands
      Script Returns Modifier and Type Method
      NONE (void) static Script<> dispatchDragEvent​(String type, Number x, Number y, Input.DragData data, Integer modifiers)
      Dispatches a drag event into the page.
      NONE (void) static Script<> dispatchKeyEvent​(String type, Integer modifiers, Number timestamp, String text, String unmodifiedText, String keyIdentifier, String code, String key, Integer windowsVirtualKeyCode, Integer nativeVirtualKeyCode, Boolean autoRepeat, Boolean isKeypad, Boolean isSystemKey, Integer location, String[] commands)
      Dispatches a key event to the page.
      NONE (void) static Script<> dispatchMouseEvent​(String type, Number x, Number y, Integer modifiers, Number timestamp, String button, Integer buttons, Integer clickCount, Number force, Number tangentialPressure, Integer tiltX, Integer tiltY, Integer twist, Number deltaX, Number deltaY, String pointerType)
      Dispatches a mouse event to the page.
      NONE (void) static Script<> dispatchTouchEvent​(String type, Input.TouchPoint[] touchPoints, Integer modifiers, Number timestamp)
      Dispatches a touch event to the page.
      NONE (void) static Script<> emulateTouchFromMouseEvent​(String type, int x, int y, String button, Number timestamp, Number deltaX, Number deltaY, Integer modifiers, Integer clickCount)
      Emulates touch event from the mouse event parameters.
      NONE (void) static Script<> imeSetComposition​(String text, int selectionStart, int selectionEnd, Integer replacementStart, Integer replacementEnd)
      This method sets the current candidate text for ime.
      NONE (void) static Script<> insertText​(String text)
      This method emulates inserting text that doesn't come from a key press, for example an emoji keyboard or an IME.
      NONE (void) static Script<> setIgnoreInputEvents​(boolean ignore)
      Ignores input events (useful while auditing page).
      NONE (void) static Script<> setInterceptDrags​(boolean enabled)
      Prevents default drag and drop behavior and instead emits Input.dragIntercepted events.
      NONE (void) static Script<> synthesizePinchGesture​(Number x, Number y, Number scaleFactor, Integer relativeSpeed, String gestureSourceType)
      Synthesizes a pinch gesture over a time period by issuing appropriate touch events.
      NONE (void) static Script<> synthesizeScrollGesture​(Number x, Number y, Number xDistance, Number yDistance, Number xOverscroll, Number yOverscroll, Boolean preventFling, Integer speed, String gestureSourceType, Integer repeatCount, Integer repeatDelayMs, String interactionMarkerName)
      Synthesizes a scroll gesture over a time period by issuing appropriate touch events.
      NONE (void) static Script<> synthesizeTapGesture​(Number x, Number y, Integer duration, Integer tapCount, String gestureSourceType)
      Synthesizes a tap gesture over a time period by issuing appropriate touch events.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • dispatchDragEvent

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.String,​JsonObject,​Ret0dispatchDragEvent​
                    (java.lang.String type,
                     java.lang.Number x,
                     java.lang.Number y,
                     Input.DragData data,
                     java.lang.Integer modifiers)
        
        Dispatches a drag event into the page.
        EXPERIMENTAL
        Parameters:
        type - Type of the drag event.
        Acceptable Values: ["dragEnter", "dragOver", "drop", "dragCancel"]
        x - X coordinate of the event relative to the main frame's viewport in CSS pixels.
        y - Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.
        data - -
        modifiers - Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
        OPTIONAL
        Returns:
        An instance of Script<String, JsonObject, Ret0>

        This Script instance must be executed before the browser receives the invocation-request.

        This Browser-Function does not have a return-value. You may choose to await the Promise<JsonObject, Ret0 > to ensure the Browser Function has run to completion.
      • dispatchKeyEvent

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.String,​JsonObject,​Ret0dispatchKeyEvent​
                    (java.lang.String type,
                     java.lang.Integer modifiers,
                     java.lang.Number timestamp,
                     java.lang.String text,
                     java.lang.String unmodifiedText,
                     java.lang.String keyIdentifier,
                     java.lang.String code,
                     java.lang.String key,
                     java.lang.Integer windowsVirtualKeyCode,
                     java.lang.Integer nativeVirtualKeyCode,
                     java.lang.Boolean autoRepeat,
                     java.lang.Boolean isKeypad,
                     java.lang.Boolean isSystemKey,
                     java.lang.Integer location,
                     java.lang.String[] commands)
        
        Dispatches a key event to the page.
        Parameters:
        type - Type of the key event.
        Acceptable Values: ["keyDown", "keyUp", "rawKeyDown", "char"]
        modifiers - Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
        OPTIONAL
        timestamp - Time at which the event occurred.
        OPTIONAL
        text - Text as generated by processing a virtual key code with a keyboard layout. Not needed for for keyUp and rawKeyDown events (default: "")
        OPTIONAL
        unmodifiedText - Text that would have been generated by the keyboard if no modifiers were pressed (except for shift). Useful for shortcut (accelerator) key handling (default: "").
        OPTIONAL
        keyIdentifier - Unique key identifier (e.g., 'U+0041') (default: "").
        OPTIONAL
        code - Unique DOM defined string value for each physical key (e.g., 'KeyA') (default: "").
        OPTIONAL
        key - Unique DOM defined string value describing the meaning of the key in the context of active modifiers, keyboard layout, etc (e.g., 'AltGr') (default: "").
        OPTIONAL
        windowsVirtualKeyCode - Windows virtual key code (default: 0).
        OPTIONAL
        nativeVirtualKeyCode - Native virtual key code (default: 0).
        OPTIONAL
        autoRepeat - Whether the event was generated from auto repeat (default: false).
        OPTIONAL
        isKeypad - Whether the event was generated from the keypad (default: false).
        OPTIONAL
        isSystemKey - Whether the event was a system key event (default: false).
        OPTIONAL
        location - Whether the event was from the left or right side of the keyboard. 1=Left, 2=Right (default: 0).
        OPTIONAL
        commands - Editing commands to send with the key event (e.g., 'selectAll') (default: []). These are related to but not equal the command names used in document.execCommand and NSStandardKeyBindingResponding. See https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/core/editing/commands/editor_command_names.h for valid command names.
        OPTIONAL
        EXPERIMENTAL
        Returns:
        An instance of Script<String, JsonObject, Ret0>

        This Script instance must be executed before the browser receives the invocation-request.

        This Browser-Function does not have a return-value. You may choose to await the Promise<JsonObject, Ret0 > to ensure the Browser Function has run to completion.
      • insertText

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.String,​JsonObject,​Ret0insertText​
                    (java.lang.String text)
        
        This method emulates inserting text that doesn't come from a key press, for example an emoji keyboard or an IME.
        EXPERIMENTAL
        Parameters:
        text - The text to insert.
        Returns:
        An instance of Script<String, JsonObject, Ret0>

        This Script instance must be executed before the browser receives the invocation-request.

        This Browser-Function does not have a return-value. You may choose to await the Promise<JsonObject, Ret0 > to ensure the Browser Function has run to completion.
      • imeSetComposition

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.String,​JsonObject,​Ret0imeSetComposition​
                    (java.lang.String text,
                     int selectionStart,
                     int selectionEnd,
                     java.lang.Integer replacementStart,
                     java.lang.Integer replacementEnd)
        
        This method sets the current candidate text for ime. Use imeCommitComposition to commit the final text. Use imeSetComposition with empty string as text to cancel composition.
        EXPERIMENTAL
        Parameters:
        text - The text to insert
        selectionStart - selection start
        selectionEnd - selection end
        replacementStart - replacement start
        OPTIONAL
        replacementEnd - replacement end
        OPTIONAL
        Returns:
        An instance of Script<String, JsonObject, Ret0>

        This Script instance must be executed before the browser receives the invocation-request.

        This Browser-Function does not have a return-value. You may choose to await the Promise<JsonObject, Ret0 > to ensure the Browser Function has run to completion.
      • dispatchMouseEvent

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.String,​JsonObject,​Ret0dispatchMouseEvent​
                    (java.lang.String type,
                     java.lang.Number x,
                     java.lang.Number y,
                     java.lang.Integer modifiers,
                     java.lang.Number timestamp,
                     java.lang.String button,
                     java.lang.Integer buttons,
                     java.lang.Integer clickCount,
                     java.lang.Number force,
                     java.lang.Number tangentialPressure,
                     java.lang.Integer tiltX,
                     java.lang.Integer tiltY,
                     java.lang.Integer twist,
                     java.lang.Number deltaX,
                     java.lang.Number deltaY,
                     java.lang.String pointerType)
        
        Dispatches a mouse event to the page.
        Parameters:
        type - Type of the mouse event.
        Acceptable Values: ["mousePressed", "mouseReleased", "mouseMoved", "mouseWheel"]
        x - X coordinate of the event relative to the main frame's viewport in CSS pixels.
        y - Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.
        modifiers - Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
        OPTIONAL
        timestamp - Time at which the event occurred.
        OPTIONAL
        button - Mouse button (default: "none").
        OPTIONAL
        buttons - A number indicating which buttons are pressed on the mouse when a mouse event is triggered. Left=1, Right=2, Middle=4, Back=8, Forward=16, None=0.
        OPTIONAL
        clickCount - Number of times the mouse button was clicked (default: 0).
        OPTIONAL
        force - The normalized pressure, which has a range of [0,1] (default: 0).
        OPTIONAL
        EXPERIMENTAL
        tangentialPressure - The normalized tangential pressure, which has a range of [-1,1] (default: 0).
        OPTIONAL
        EXPERIMENTAL
        tiltX - The plane angle between the Y-Z plane and the plane containing both the stylus axis and the Y axis, in degrees of the range [-90,90], a positive tiltX is to the right (default: 0).
        OPTIONAL
        EXPERIMENTAL
        tiltY - The plane angle between the X-Z plane and the plane containing both the stylus axis and the X axis, in degrees of the range [-90,90], a positive tiltY is towards the user (default: 0).
        OPTIONAL
        EXPERIMENTAL
        twist - The clockwise rotation of a pen stylus around its own major axis, in degrees in the range [0,359] (default: 0).
        OPTIONAL
        EXPERIMENTAL
        deltaX - X delta in CSS pixels for mouse wheel event (default: 0).
        OPTIONAL
        deltaY - Y delta in CSS pixels for mouse wheel event (default: 0).
        OPTIONAL
        pointerType - Pointer type (default: "mouse").
        Acceptable Values: ["mouse", "pen"]
        OPTIONAL
        Returns:
        An instance of Script<String, JsonObject, Ret0>

        This Script instance must be executed before the browser receives the invocation-request.

        This Browser-Function does not have a return-value. You may choose to await the Promise<JsonObject, Ret0 > to ensure the Browser Function has run to completion.
      • dispatchTouchEvent

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.String,​JsonObject,​Ret0dispatchTouchEvent​
                    (java.lang.String type,
                     Input.TouchPoint[] touchPoints,
                     java.lang.Integer modifiers,
                     java.lang.Number timestamp)
        
        Dispatches a touch event to the page.
        Parameters:
        type - Type of the touch event. TouchEnd and TouchCancel must not contain any touch points, while TouchStart and TouchMove must contains at least one.
        Acceptable Values: ["touchStart", "touchEnd", "touchMove", "touchCancel"]
        touchPoints - Active touch points on the touch device. One event per any changed point (compared to previous touch event in a sequence) is generated, emulating pressing/moving/releasing points one by one.
        modifiers - Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
        OPTIONAL
        timestamp - Time at which the event occurred.
        OPTIONAL
        Returns:
        An instance of Script<String, JsonObject, Ret0>

        This Script instance must be executed before the browser receives the invocation-request.

        This Browser-Function does not have a return-value. You may choose to await the Promise<JsonObject, Ret0 > to ensure the Browser Function has run to completion.
      • emulateTouchFromMouseEvent

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.String,​JsonObject,​Ret0emulateTouchFromMouseEvent​
                    (java.lang.String type,
                     int x,
                     int y,
                     java.lang.String button,
                     java.lang.Number timestamp,
                     java.lang.Number deltaX,
                     java.lang.Number deltaY,
                     java.lang.Integer modifiers,
                     java.lang.Integer clickCount)
        
        Emulates touch event from the mouse event parameters.
        EXPERIMENTAL
        Parameters:
        type - Type of the mouse event.
        Acceptable Values: ["mousePressed", "mouseReleased", "mouseMoved", "mouseWheel"]
        x - X coordinate of the mouse pointer in DIP.
        y - Y coordinate of the mouse pointer in DIP.
        button - Mouse button. Only "none", "left", "right" are supported.
        timestamp - Time at which the event occurred (default: current time).
        OPTIONAL
        deltaX - X delta in DIP for mouse wheel event (default: 0).
        OPTIONAL
        deltaY - Y delta in DIP for mouse wheel event (default: 0).
        OPTIONAL
        modifiers - Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
        OPTIONAL
        clickCount - Number of times the mouse button was clicked (default: 0).
        OPTIONAL
        Returns:
        An instance of Script<String, JsonObject, Ret0>

        This Script instance must be executed before the browser receives the invocation-request.

        This Browser-Function does not have a return-value. You may choose to await the Promise<JsonObject, Ret0 > to ensure the Browser Function has run to completion.
      • setIgnoreInputEvents

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.String,​JsonObject,​Ret0setIgnoreInputEvents​
                    (boolean ignore)
        
        Ignores input events (useful while auditing page).
        Parameters:
        ignore - Ignores input events processing when set to true.
        Returns:
        An instance of Script<String, JsonObject, Ret0>

        This Script instance must be executed before the browser receives the invocation-request.

        This Browser-Function does not have a return-value. You may choose to await the Promise<JsonObject, Ret0 > to ensure the Browser Function has run to completion.
      • setInterceptDrags

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.String,​JsonObject,​Ret0setInterceptDrags​
                    (boolean enabled)
        
        Prevents default drag and drop behavior and instead emits Input.dragIntercepted events. Drag and drop behavior can be directly controlled via Input.dispatchDragEvent.
        EXPERIMENTAL
        Parameters:
        enabled - -
        Returns:
        An instance of Script<String, JsonObject, Ret0>

        This Script instance must be executed before the browser receives the invocation-request.

        This Browser-Function does not have a return-value. You may choose to await the Promise<JsonObject, Ret0 > to ensure the Browser Function has run to completion.
      • synthesizePinchGesture

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.String,​JsonObject,​Ret0synthesizePinchGesture​
                    (java.lang.Number x,
                     java.lang.Number y,
                     java.lang.Number scaleFactor,
                     java.lang.Integer relativeSpeed,
                     java.lang.String gestureSourceType)
        
        Synthesizes a pinch gesture over a time period by issuing appropriate touch events.
        EXPERIMENTAL
        Parameters:
        x - X coordinate of the start of the gesture in CSS pixels.
        y - Y coordinate of the start of the gesture in CSS pixels.
        scaleFactor - Relative scale factor after zooming (>1.0 zooms in, <1.0 zooms out).
        relativeSpeed - Relative pointer speed in pixels per second (default: 800).
        OPTIONAL
        gestureSourceType - Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type).
        OPTIONAL
        Returns:
        An instance of Script<String, JsonObject, Ret0>

        This Script instance must be executed before the browser receives the invocation-request.

        This Browser-Function does not have a return-value. You may choose to await the Promise<JsonObject, Ret0 > to ensure the Browser Function has run to completion.
      • synthesizeScrollGesture

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.String,​JsonObject,​Ret0synthesizeScrollGesture​
                    (java.lang.Number x,
                     java.lang.Number y,
                     java.lang.Number xDistance,
                     java.lang.Number yDistance,
                     java.lang.Number xOverscroll,
                     java.lang.Number yOverscroll,
                     java.lang.Boolean preventFling,
                     java.lang.Integer speed,
                     java.lang.String gestureSourceType,
                     java.lang.Integer repeatCount,
                     java.lang.Integer repeatDelayMs,
                     java.lang.String interactionMarkerName)
        
        Synthesizes a scroll gesture over a time period by issuing appropriate touch events.
        EXPERIMENTAL
        Parameters:
        x - X coordinate of the start of the gesture in CSS pixels.
        y - Y coordinate of the start of the gesture in CSS pixels.
        xDistance - The distance to scroll along the X axis (positive to scroll left).
        OPTIONAL
        yDistance - The distance to scroll along the Y axis (positive to scroll up).
        OPTIONAL
        xOverscroll - The number of additional pixels to scroll back along the X axis, in addition to the given distance.
        OPTIONAL
        yOverscroll - The number of additional pixels to scroll back along the Y axis, in addition to the given distance.
        OPTIONAL
        preventFling - Prevent fling (default: true).
        OPTIONAL
        speed - Swipe speed in pixels per second (default: 800).
        OPTIONAL
        gestureSourceType - Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type).
        OPTIONAL
        repeatCount - The number of times to repeat the gesture (default: 0).
        OPTIONAL
        repeatDelayMs - The number of milliseconds delay between each repeat. (default: 250).
        OPTIONAL
        interactionMarkerName - The name of the interaction markers to generate, if not empty (default: "").
        OPTIONAL
        Returns:
        An instance of Script<String, JsonObject, Ret0>

        This Script instance must be executed before the browser receives the invocation-request.

        This Browser-Function does not have a return-value. You may choose to await the Promise<JsonObject, Ret0 > to ensure the Browser Function has run to completion.
      • synthesizeTapGesture

        🡅     🗕  🗗  🗖
        public static Script<java.lang.String,​JsonObject,​Ret0synthesizeTapGesture​
                    (java.lang.Number x,
                     java.lang.Number y,
                     java.lang.Integer duration,
                     java.lang.Integer tapCount,
                     java.lang.String gestureSourceType)
        
        Synthesizes a tap gesture over a time period by issuing appropriate touch events.
        EXPERIMENTAL
        Parameters:
        x - X coordinate of the start of the gesture in CSS pixels.
        y - Y coordinate of the start of the gesture in CSS pixels.
        duration - Duration between touchdown and touchup events in ms (default: 50).
        OPTIONAL
        tapCount - Number of times to perform the tap (e.g. 2 for double tap, default: 1).
        OPTIONAL
        gestureSourceType - Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type).
        OPTIONAL
        Returns:
        An instance of Script<String, JsonObject, Ret0>

        This Script instance must be executed before the browser receives the invocation-request.

        This Browser-Function does not have a return-value. You may choose to await the Promise<JsonObject, Ret0 > to ensure the Browser Function has run to completion.