File tree 2 files changed +17
-0
lines changed
android_tests/lib/android/specs/common
2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change 64
64
act . class . must_equal Selenium ::WebDriver ::Element
65
65
end
66
66
67
+ t 'keyevent' do
68
+ keyevent key : 176
69
+ end
70
+
67
71
t 'action_chain' do
68
72
e = find_element ( :name , "Accessibility" )
69
73
Appium ::TouchAction . new . press ( :element => e , x : 0.5 , y : 0.5 ) . release ( :element => e ) . perform
Original file line number Diff line number Diff line change @@ -62,6 +62,11 @@ module Device
62
62
# hide_keyboard('Finished') # Close a keyboard with the 'Finished' button
63
63
# ```
64
64
65
+ # @!method key_event
66
+ # Send a key event to the device.
67
+ # @param key (integer) The key to send.
68
+ # @param metastate (String) The state the metakeys should be in when sending the key.
69
+
65
70
# @!method push_file
66
71
# Place a file in a specific location on the device.
67
72
# @param path (String) The absolute path on the device to store data at.
@@ -126,6 +131,14 @@ def hide_keyboard(close_key='Done')
126
131
end
127
132
end
128
133
134
+ add_endpoint_method ( :key_event , 'session/:session_id/appium/device/keyevent' ) do
135
+ def key_event ( key , metastate = nil )
136
+ args = { keycode : key }
137
+ args [ :metastate ] = metastate if metastate
138
+ execute :key_event , { } , args
139
+ end
140
+ end
141
+
129
142
add_endpoint_method ( :complex_find , 'session/:session_id/appium/app/complex_find' ) do
130
143
def complex_find ( all , selectors = nil )
131
144
if selectors . nil?
You can’t perform that action at this time.
0 commit comments