38
39
40
41
42
43
44
45
46
47
|
# File 'lib/appium_lib_core/common/device/keyevent.rb', line 38
def long_press_keycode(key, metastate: [], flags: [])
raise ::Appium::Core::Error::ArgumentError, 'flags should be Array' unless flags.is_a? Array
raise ::Appium::Core::Error::ArgumentError, 'metastates should be Array' unless metastate.is_a? Array
args = { keycode: key, isLongPress: true }
args[:metastate] = metastate.reduce(0) { |acc, meta| acc | meta } unless metastate.empty?
args[:flags] = flags.reduce(0) { |acc, flag| acc | flag } unless flags.empty?
execute_script 'mobile:pressKey', args
end
|