Interface InputAsync


public interface InputAsync
  • Method Details

    • dispatchDragEvent

      CompletableFuture<Void> dispatchDragEvent(DispatchDragEvent type, Double x, Double y, DragData data)
      Dispatches a drag event into the page.
      Parameters:
      type - Type of the drag event.
      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.
    • dispatchDragEvent

      CompletableFuture<Void> dispatchDragEvent(DispatchDragEvent type, Double x, Double y, DragData data, Integer modifiers)
      Dispatches a drag event into the page.
      Parameters:
      type - Type of the drag event.
      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).
    • dispatchKeyEvent

      CompletableFuture<Void> dispatchKeyEvent(KeyEventType type)
      Dispatches a key event to the page.
      Parameters:
      type - Type of the key event.
    • dispatchKeyEvent

      CompletableFuture<Void> dispatchKeyEvent(KeyEventType type, Integer modifiers, Double timestamp, String text, String unmodifiedText, String keyIdentifier, String code, String key, Integer windowsVirtualKeyCode, Integer nativeVirtualKeyCode, Boolean autoRepeat, Boolean isKeypad, Boolean isSystemKey, Integer location, List<String> commands)
      Dispatches a key event to the page.
      Parameters:
      type - Type of the key event.
      modifiers - Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
      timestamp - Time at which the event occurred.
      text - Text as generated by processing a virtual key code with a keyboard layout. Not needed for for keyUp and rawKeyDown events (default: "")
      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: "").
      keyIdentifier - Unique key identifier (e.g., 'U+0041') (default: "").
      code - Unique DOM defined string value for each physical key (e.g., 'KeyA') (default: "").
      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: "").
      windowsVirtualKeyCode - Windows virtual key code (default: 0).
      nativeVirtualKeyCode - Native virtual key code (default: 0).
      autoRepeat - Whether the event was generated from auto repeat (default: false).
      isKeypad - Whether the event was generated from the keypad (default: false).
      isSystemKey - Whether the event was a system key event (default: false).
      location - Whether the event was from the left or right side of the keyboard. 1=Left, 2=Right (default: 0).
      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/+/main:third_party/blink/renderer/core/editing/commands/editor_command_names.h for valid command names.
    • dispatchMouseEvent

      CompletableFuture<Void> dispatchMouseEvent(MouseEventType type, Double x, Double y)
      Dispatches a mouse event to the page.
      Parameters:
      type - Type of the mouse event.
      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.
    • dispatchMouseEvent

      CompletableFuture<Void> dispatchMouseEvent(MouseEventType type, Double x, Double y, Integer modifiers, Double timestamp, MouseButton button, Integer buttons, Integer clickCount, Double force, Double tangentialPressure, Integer tiltX, Integer tiltY, Integer twist, Double deltaX, Double deltaY, PointerType pointerType)
      Dispatches a mouse event to the page.
      Parameters:
      type - Type of the mouse event.
      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).
      timestamp - Time at which the event occurred.
      button - Mouse button (default: "none").
      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.
      clickCount - Number of times the mouse button was clicked (default: 0).
      force - The normalized pressure, which has a range of [0,1] (default: 0).
      tangentialPressure - The normalized tangential pressure, which has a range of [-1,1] (default: 0).
      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).
      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).
      twist - The clockwise rotation of a pen stylus around its own major axis, in degrees in the range [0,359] (default: 0).
      deltaX - X delta in CSS pixels for mouse wheel event (default: 0).
      deltaY - Y delta in CSS pixels for mouse wheel event (default: 0).
      pointerType - Pointer type (default: "mouse").
    • dispatchTouchEvent

      CompletableFuture<Void> dispatchTouchEvent(TouchEventType type, List<TouchPoint> touchPoints)
      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.
      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.
    • dispatchTouchEvent

      CompletableFuture<Void> dispatchTouchEvent(TouchEventType type, List<TouchPoint> touchPoints, Integer modifiers, Double 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.
      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).
      timestamp - Time at which the event occurred.
    • emulateTouchFromMouseEvent

      CompletableFuture<Void> emulateTouchFromMouseEvent(MouseEventType type, Integer x, Integer y, MouseButton button)
      Emulates touch event from the mouse event parameters.
      Parameters:
      type - Type of the mouse event.
      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.
    • emulateTouchFromMouseEvent

      CompletableFuture<Void> emulateTouchFromMouseEvent(MouseEventType type, Integer x, Integer y, MouseButton button, Double timestamp, Double deltaX, Double deltaY, Integer modifiers, Integer clickCount)
      Emulates touch event from the mouse event parameters.
      Parameters:
      type - Type of the mouse event.
      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).
      deltaX - X delta in DIP for mouse wheel event (default: 0).
      deltaY - Y delta in DIP for mouse wheel event (default: 0).
      modifiers - Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
      clickCount - Number of times the mouse button was clicked (default: 0).
    • imeSetComposition

      CompletableFuture<Void> imeSetComposition(String text, Integer selectionStart, Integer selectionEnd)
      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.
      Parameters:
      text - The text to insert
      selectionStart - selection start
      selectionEnd - selection end
    • imeSetComposition

      CompletableFuture<Void> imeSetComposition(String text, Integer selectionStart, Integer selectionEnd, Integer replacementStart, 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.
      Parameters:
      text - The text to insert
      selectionStart - selection start
      selectionEnd - selection end
      replacementStart - replacement start
      replacementEnd - replacement end
    • insertText

      CompletableFuture<Void> insertText(String text)
      This method emulates inserting text that doesn't come from a key press, for example an emoji keyboard or an IME.
      Parameters:
      text - The text to insert.
    • setIgnoreInputEvents

      CompletableFuture<Void> setIgnoreInputEvents(Boolean ignore)
      Ignores input events (useful while auditing page).
      Parameters:
      ignore - Ignores input events processing when set to true.
    • setInterceptDrags

      CompletableFuture<Void> setInterceptDrags(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.
    • synthesizePinchGesture

      CompletableFuture<Void> synthesizePinchGesture(Double x, Double y, Double scaleFactor)
      Synthesizes a pinch gesture over a time period by issuing appropriate touch events.
      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, invalid input: '<'1.0 zooms out).
    • synthesizePinchGesture

      CompletableFuture<Void> synthesizePinchGesture(Double x, Double y, Double scaleFactor, Integer relativeSpeed, GestureSourceType gestureSourceType)
      Synthesizes a pinch gesture over a time period by issuing appropriate touch events.
      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, invalid input: '<'1.0 zooms out).
      relativeSpeed - Relative pointer speed in pixels per second (default: 800).
      gestureSourceType - Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type).
    • synthesizeScrollGesture

      CompletableFuture<Void> synthesizeScrollGesture(Double x, Double y)
      Synthesizes a scroll gesture over a time period by issuing appropriate touch events.
      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.
    • synthesizeScrollGesture

      CompletableFuture<Void> synthesizeScrollGesture(Double x, Double y, Double xDistance, Double yDistance, Double xOverscroll, Double yOverscroll, Boolean preventFling, Integer speed, GestureSourceType gestureSourceType, Integer repeatCount, Integer repeatDelayMs, String interactionMarkerName)
      Synthesizes a scroll gesture over a time period by issuing appropriate touch events.
      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).
      yDistance - The distance to scroll along the Y axis (positive to scroll up).
      xOverscroll - The number of additional pixels to scroll back along the X axis, in addition to the given distance.
      yOverscroll - The number of additional pixels to scroll back along the Y axis, in addition to the given distance.
      preventFling - Prevent fling (default: true).
      speed - Swipe speed in pixels per second (default: 800).
      gestureSourceType - Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type).
      repeatCount - The number of times to repeat the gesture (default: 0).
      repeatDelayMs - The number of milliseconds delay between each repeat. (default: 250).
      interactionMarkerName - The name of the interaction markers to generate, if not empty (default: "").
    • synthesizeTapGesture

      CompletableFuture<Void> synthesizeTapGesture(Double x, Double y)
      Synthesizes a tap gesture over a time period by issuing appropriate touch events.
      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.
    • synthesizeTapGesture

      CompletableFuture<Void> synthesizeTapGesture(Double x, Double y, Integer duration, Integer tapCount, GestureSourceType gestureSourceType)
      Synthesizes a tap gesture over a time period by issuing appropriate touch events.
      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).
      tapCount - Number of times to perform the tap (e.g. 2 for double tap, default: 1).
      gestureSourceType - Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type).