Tungsten v0.1.0 Tungsten.CDP.Input View Source

Input

This domain has no documentation

Link to this section Summary

Link to this section Types

Link to this type

cdp_gesture_source_type_type() View Source
cdp_gesture_source_type_type() :: :mouse | :touch | :default

Input.GestureSourceType

This type has no documentation

Link to this type

cdp_time_since_epoch_type() View Source
cdp_time_since_epoch_type() :: integer() | float()

Input.TimeSinceEpoch

UTC time in seconds, counted from January 1, 1970.

Link to this type

cdp_touch_point_type() View Source
cdp_touch_point_type() :: %{
  :x => integer() | float(),
  :y => integer() | float(),
  optional(:radius_x) => integer() | float(),
  optional(:radius_y) => integer() | float(),
  optional(:rotation_angle) => integer() | float(),
  optional(:force) => integer() | float(),
  optional(:id) => integer() | float()
}

Input.TouchPoint

This type has no documentation

Link to this section Functions

Link to this function

dispatch_key_event(session, parameters, options \\ []) View Source
dispatch_key_event(
  GenServer.server(),
  %{
    :type => :char | :raw_key_down | :key_up | :key_down,
    optional(:modifiers) => integer(),
    optional(:timestamp) => cdp_time_since_epoch_type(),
    optional(:text) => String.t(),
    optional(:unmodified_text) => String.t(),
    optional(:key_identifier) => String.t(),
    optional(:code) => String.t(),
    optional(:key) => String.t(),
    optional(:windows_virtual_key_code) => integer(),
    optional(:native_virtual_key_code) => integer(),
    optional(:auto_repeat) => boolean(),
    optional(:is_keypad) => boolean(),
    optional(:is_system_key) => boolean(),
    optional(:location) => integer()
  },
  Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}

Input.dispatchKeyEvent

Dispatches a key event to the page.

Link to this function

dispatch_mouse_event(session, parameters, options \\ []) View Source
dispatch_mouse_event(
  GenServer.server(),
  %{
    :type => :mouse_wheel | :mouse_moved | :mouse_released | :mouse_pressed,
    :x => integer() | float(),
    :y => integer() | float(),
    optional(:modifiers) => integer(),
    optional(:timestamp) => cdp_time_since_epoch_type(),
    optional(:button) => :forward | :back | :right | :middle | :left | :none,
    optional(:buttons) => integer(),
    optional(:click_count) => integer(),
    optional(:delta_x) => integer() | float(),
    optional(:delta_y) => integer() | float(),
    optional(:pointer_type) => :pen | :mouse
  },
  Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}

Input.dispatchMouseEvent

Dispatches a mouse event to the page.

Link to this function

dispatch_touch_event(session, parameters, options \\ []) View Source
dispatch_touch_event(
  GenServer.server(),
  %{
    :type => :touch_cancel | :touch_move | :touch_end | :touch_start,
    :touch_points => [cdp_touch_point_type()],
    optional(:modifiers) => integer(),
    optional(:timestamp) => cdp_time_since_epoch_type()
  },
  Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}

Input.dispatchTouchEvent

Dispatches a touch event to the page.

Link to this function

emulate_touch_from_mouse_event(session, parameters, options \\ []) View Source
emulate_touch_from_mouse_event(
  GenServer.server(),
  %{
    :type => :mouse_wheel | :mouse_moved | :mouse_released | :mouse_pressed,
    :x => integer(),
    :y => integer(),
    :button => :right | :middle | :left | :none,
    optional(:timestamp) => cdp_time_since_epoch_type(),
    optional(:delta_x) => integer() | float(),
    optional(:delta_y) => integer() | float(),
    optional(:modifiers) => integer(),
    optional(:click_count) => integer()
  },
  Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}

Input.emulateTouchFromMouseEvent

Emulates touch event from the mouse event parameters.

Link to this function

insert_text(session, parameters, options \\ []) View Source
insert_text(
  GenServer.server(),
  %{text: String.t()},
  Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}

Input.insertText

This method emulates inserting text that doesn't come from a key press, for example an emoji keyboard or an IME.

Link to this function

set_ignore_input_events(session, parameters, options \\ []) View Source
set_ignore_input_events(
  GenServer.server(),
  %{ignore: boolean()},
  Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}

Input.setIgnoreInputEvents

Ignores input events (useful while auditing page).

Link to this function

synthesize_pinch_gesture(session, parameters, options \\ []) View Source
synthesize_pinch_gesture(
  GenServer.server(),
  %{
    :x => integer() | float(),
    :y => integer() | float(),
    :scale_factor => integer() | float(),
    optional(:relative_speed) => integer(),
    optional(:gesture_source_type) => cdp_gesture_source_type_type()
  },
  Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}

Input.synthesizePinchGesture

Synthesizes a pinch gesture over a time period by issuing appropriate touch events.

Link to this function

synthesize_scroll_gesture(session, parameters, options \\ []) View Source
synthesize_scroll_gesture(
  GenServer.server(),
  %{
    :x => integer() | float(),
    :y => integer() | float(),
    optional(:x_distance) => integer() | float(),
    optional(:y_distance) => integer() | float(),
    optional(:x_overscroll) => integer() | float(),
    optional(:y_overscroll) => integer() | float(),
    optional(:prevent_fling) => boolean(),
    optional(:speed) => integer(),
    optional(:gesture_source_type) => cdp_gesture_source_type_type(),
    optional(:repeat_count) => integer(),
    optional(:repeat_delay_ms) => integer(),
    optional(:interaction_marker_name) => String.t()
  },
  Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}

Input.synthesizeScrollGesture

Synthesizes a scroll gesture over a time period by issuing appropriate touch events.

Link to this function

synthesize_tap_gesture(session, parameters, options \\ []) View Source
synthesize_tap_gesture(
  GenServer.server(),
  %{
    :x => integer() | float(),
    :y => integer() | float(),
    optional(:duration) => integer(),
    optional(:tap_count) => integer(),
    optional(:gesture_source_type) => cdp_gesture_source_type_type()
  },
  Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}

Input.synthesizeTapGesture

Synthesizes a tap gesture over a time period by issuing appropriate touch events.