Class: Selenium::DevTools::V130::Input

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/devtools/v130/input.rb

Constant Summary collapse

EVENTS =
{
  drag_intercepted: 'dragIntercepted',
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(devtools) ⇒ Input

Returns a new instance of Input.



29
30
31
# File 'lib/selenium/devtools/v130/input.rb', line 29

def initialize(devtools)
  @devtools = devtools
end

Instance Method Details

#cancel_draggingObject



108
109
110
# File 'lib/selenium/devtools/v130/input.rb', line 108

def cancel_dragging
  @devtools.send_cmd('Input.cancelDragging')
end

#dispatch_drag_event(type:, x:, y:, data:, modifiers: nil) ⇒ Object



38
39
40
41
42
43
44
45
# File 'lib/selenium/devtools/v130/input.rb', line 38

def dispatch_drag_event(type:, x:, y:, data:, modifiers: nil)
  @devtools.send_cmd('Input.dispatchDragEvent',
                     type: type,
                     x: x,
                     y: y,
                     data: data,
                     modifiers: modifiers)
end

#dispatch_key_event(type:, modifiers: nil, timestamp: nil, text: nil, unmodified_text: nil, key_identifier: nil, code: nil, key: nil, windows_virtual_key_code: nil, native_virtual_key_code: nil, auto_repeat: nil, is_keypad: nil, is_system_key: nil, location: nil, commands: nil) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/selenium/devtools/v130/input.rb', line 47

def dispatch_key_event(type:, modifiers: nil, timestamp: nil, text: nil, unmodified_text: nil, key_identifier: nil, code: nil, key: nil, windows_virtual_key_code: nil, native_virtual_key_code: nil, auto_repeat: nil, is_keypad: nil, is_system_key: nil, location: nil, commands: nil)
  @devtools.send_cmd('Input.dispatchKeyEvent',
                     type: type,
                     modifiers: modifiers,
                     timestamp: timestamp,
                     text: text,
                     unmodifiedText: unmodified_text,
                     keyIdentifier: key_identifier,
                     code: code,
                     key: key,
                     windowsVirtualKeyCode: windows_virtual_key_code,
                     nativeVirtualKeyCode: native_virtual_key_code,
                     autoRepeat: auto_repeat,
                     isKeypad: is_keypad,
                     isSystemKey: is_system_key,
                     location: location,
                     commands: commands)
end

#dispatch_mouse_event(type:, x:, y:, modifiers: nil, timestamp: nil, button: nil, buttons: nil, click_count: nil, force: nil, tangential_pressure: nil, tilt_x: nil, tilt_y: nil, twist: nil, delta_x: nil, delta_y: nil, pointer_type: nil) ⇒ Object



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/selenium/devtools/v130/input.rb', line 80

def dispatch_mouse_event(type:, x:, y:, modifiers: nil, timestamp: nil, button: nil, buttons: nil, click_count: nil, force: nil, tangential_pressure: nil, tilt_x: nil, tilt_y: nil, twist: nil, delta_x: nil, delta_y: nil, pointer_type: nil)
  @devtools.send_cmd('Input.dispatchMouseEvent',
                     type: type,
                     x: x,
                     y: y,
                     modifiers: modifiers,
                     timestamp: timestamp,
                     button: button,
                     buttons: buttons,
                     clickCount: click_count,
                     force: force,
                     tangentialPressure: tangential_pressure,
                     tiltX: tilt_x,
                     tiltY: tilt_y,
                     twist: twist,
                     deltaX: delta_x,
                     deltaY: delta_y,
                     pointerType: pointer_type)
end

#dispatch_touch_event(type:, touch_points:, modifiers: nil, timestamp: nil) ⇒ Object



100
101
102
103
104
105
106
# File 'lib/selenium/devtools/v130/input.rb', line 100

def dispatch_touch_event(type:, touch_points:, modifiers: nil, timestamp: nil)
  @devtools.send_cmd('Input.dispatchTouchEvent',
                     type: type,
                     touchPoints: touch_points,
                     modifiers: modifiers,
                     timestamp: timestamp)
end

#emulate_touch_from_mouse_event(type:, x:, y:, button:, timestamp: nil, delta_x: nil, delta_y: nil, modifiers: nil, click_count: nil) ⇒ Object



112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/selenium/devtools/v130/input.rb', line 112

def emulate_touch_from_mouse_event(type:, x:, y:, button:, timestamp: nil, delta_x: nil, delta_y: nil, modifiers: nil, click_count: nil)
  @devtools.send_cmd('Input.emulateTouchFromMouseEvent',
                     type: type,
                     x: x,
                     y: y,
                     button: button,
                     timestamp: timestamp,
                     deltaX: delta_x,
                     deltaY: delta_y,
                     modifiers: modifiers,
                     clickCount: click_count)
end

#ime_set_composition(text:, selection_start:, selection_end:, replacement_start: nil, replacement_end: nil) ⇒ Object



71
72
73
74
75
76
77
78
# File 'lib/selenium/devtools/v130/input.rb', line 71

def ime_set_composition(text:, selection_start:, selection_end:, replacement_start: nil, replacement_end: nil)
  @devtools.send_cmd('Input.imeSetComposition',
                     text: text,
                     selectionStart: selection_start,
                     selectionEnd: selection_end,
                     replacementStart: replacement_start,
                     replacementEnd: replacement_end)
end

#insert_text(text:) ⇒ Object



66
67
68
69
# File 'lib/selenium/devtools/v130/input.rb', line 66

def insert_text(text:)
  @devtools.send_cmd('Input.insertText',
                     text: text)
end

#on(event, &block) ⇒ Object



33
34
35
36
# File 'lib/selenium/devtools/v130/input.rb', line 33

def on(event, &block)
  event = EVENTS[event] if event.is_a?(Symbol)
  @devtools.callbacks["Input.#{event}"] << block
end

#set_ignore_input_events(ignore:) ⇒ Object



125
126
127
128
# File 'lib/selenium/devtools/v130/input.rb', line 125

def set_ignore_input_events(ignore:)
  @devtools.send_cmd('Input.setIgnoreInputEvents',
                     ignore: ignore)
end

#set_intercept_drags(enabled:) ⇒ Object



130
131
132
133
# File 'lib/selenium/devtools/v130/input.rb', line 130

def set_intercept_drags(enabled:)
  @devtools.send_cmd('Input.setInterceptDrags',
                     enabled: enabled)
end

#synthesize_pinch_gesture(x:, y:, scale_factor:, relative_speed: nil, gesture_source_type: nil) ⇒ Object



135
136
137
138
139
140
141
142
# File 'lib/selenium/devtools/v130/input.rb', line 135

def synthesize_pinch_gesture(x:, y:, scale_factor:, relative_speed: nil, gesture_source_type: nil)
  @devtools.send_cmd('Input.synthesizePinchGesture',
                     x: x,
                     y: y,
                     scaleFactor: scale_factor,
                     relativeSpeed: relative_speed,
                     gestureSourceType: gesture_source_type)
end

#synthesize_scroll_gesture(x:, y:, x_distance: nil, y_distance: nil, x_overscroll: nil, y_overscroll: nil, prevent_fling: nil, speed: nil, gesture_source_type: nil, repeat_count: nil, repeat_delay_ms: nil, interaction_marker_name: nil) ⇒ Object



144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/selenium/devtools/v130/input.rb', line 144

def synthesize_scroll_gesture(x:, y:, x_distance: nil, y_distance: nil, x_overscroll: nil, y_overscroll: nil, prevent_fling: nil, speed: nil, gesture_source_type: nil, repeat_count: nil, repeat_delay_ms: nil, interaction_marker_name: nil)
  @devtools.send_cmd('Input.synthesizeScrollGesture',
                     x: x,
                     y: y,
                     xDistance: x_distance,
                     yDistance: y_distance,
                     xOverscroll: x_overscroll,
                     yOverscroll: y_overscroll,
                     preventFling: prevent_fling,
                     speed: speed,
                     gestureSourceType: gesture_source_type,
                     repeatCount: repeat_count,
                     repeatDelayMs: repeat_delay_ms,
                     interactionMarkerName: interaction_marker_name)
end

#synthesize_tap_gesture(x:, y:, duration: nil, tap_count: nil, gesture_source_type: nil) ⇒ Object



160
161
162
163
164
165
166
167
# File 'lib/selenium/devtools/v130/input.rb', line 160

def synthesize_tap_gesture(x:, y:, duration: nil, tap_count: nil, gesture_source_type: nil)
  @devtools.send_cmd('Input.synthesizeTapGesture',
                     x: x,
                     y: y,
                     duration: duration,
                     tapCount: tap_count,
                     gestureSourceType: gesture_source_type)
end