Sha256: 2059b6cd1fa9a21c3e4cf2bf215a9e356faf60af25fb37567427ddf972a50bb9
Contents?: true
Size: 1.78 KB
Versions: 3
Compression:
Stored size: 1.78 KB
Contents
module Appium module Core module Device module KeyEvent def self.add_methods # Only for Selendroid ::Appium::Core::Device.add_endpoint_method(:keyevent) do def keyevent(key, metastate = nil) args = { keycode: key } args[:metastate] = metastate if metastate execute :keyevent, {}, args end end ::Appium::Core::Device.add_endpoint_method(:press_keycode) do def press_keycode(key, metastate: [], flags: []) raise ArgumentError, 'flags should be Array' unless flags.is_a? Array raise ArgumentError, 'metastates should be Array' unless metastate.is_a? Array args = { keycode: key } 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 :press_keycode, {}, args end end ::Appium::Core::Device.add_endpoint_method(:long_press_keycode) do def long_press_keycode(key, metastate: [], flags: []) raise ArgumentError, 'flags should be Array' unless flags.is_a? Array raise ArgumentError, 'metastates should be Array' unless metastate.is_a? Array args = { keycode: key } 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 :long_press_keycode, {}, args end end end end # module KeyEvent end # module Device end # module Core end # module Appium
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
appium_lib_core-1.7.2 | lib/appium_lib_core/device/keyevent.rb |
appium_lib_core-1.7.1 | lib/appium_lib_core/device/keyevent.rb |
appium_lib_core-1.7.0 | lib/appium_lib_core/device/keyevent.rb |