Module: Briar::UIA
- Defined in:
- lib/briar/uia/briar_uia.rb
Instance Method Summary collapse
- #uia_handle_target_command(cmd, *query_args) ⇒ Object
- #uia_touch_with_options(point, opts = {}) ⇒ Object
Instance Method Details
#uia_handle_target_command(cmd, *query_args) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/briar/uia/briar_uia.rb', line 6 def uia_handle_target_command(cmd, *query_args) args = query_args.map do |part| if part.is_a?(String) "#{escape_uia_string(part)}" else "#{escape_uia_string(part.to_edn)}" end end command = %Q[target.#{cmd}(#{args.join(', ')})] if ENV['DEBUG'] == '1' puts 'Sending UIA command' puts command end s=send_uia_command :command => command if ENV['DEBUG'] == '1' puts 'Result' p s end if s['status'] == 'success' s['value'] else raise s end end |
#uia_touch_with_options(point, opts = {}) ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/briar/uia/briar_uia.rb', line 31 def (point, opts={}) defaults = {:tap_count => 1, :touch_count => 1, :duration => 0.0} opts = defaults.merge(opts) pt = "{x: #{point[:x]}, y: #{point[:y]}}" args = "{tapCount: #{opts[:tap_count]}, touchCount: #{opts[:touch_count]}, duration: #{opts[:duration]}}" uia_handle_target_command(:tapWithOptions, pt, args) end |