performAction('go_back')
2) Enter key on virtual key pad
performAction('send_key_enter')
3) Swipe right and left / Scroll up down
3) Swipe right and left / Scroll up down
performAction('swipe', 'left')
performAction('swipe', 'right')
performAction('scroll_down')
if text is shown return true else false
def wait_for_page_to_load(text, time_out)
begin
wait_poll({:until_exists => "* marked:'#{text}'", :timeout => time_out}) do
puts "wait_for_page_to_load: checking text #{text}"
end
rescue
return false
end
return true
end
5) Scroll up and down
def scroll_view(dir)
if (dir=="up")
performAction('drag', 50, 50, 70, 90, 10)
elsif (dir=="down")
performAction('drag', 50, 50, 90, 70, 10)
end
end
6) Read test data from excel
require 'rubyXL'
def read_test_data()
file_path=$g_booking_data
workbook = RubyXL::Parser.parse(file_path)
hash_arr=workbook[1].get_table(["Surname", "Today"])
return hash_arr[:table]
end
How to enter other keys from virtual keypad to the app text field ??
ReplyDeleteuse this method
ReplyDeletedef enter_text_android(text)
sleep 2
command = "#{default_device.adb_command} shell input text '#{text.to_s}'"
raise "Could not send text" unless system(command)
end
thanks
DeleteHow to check button element and press if its true then proceed to the next steps if false.
ReplyDeleteuse element_exists to check if the element is present
ReplyDeleteexample:
if element_exists(query)
// do some steps
end
performAction('drag', 50, 50, 70, 90, 10) .. could you please explain the parameters used in drag function . The first 4 parameters are x and y co-ordinates. How did you get that value? and what's 10 ?
ReplyDeleteperformAction('drag',fromX,toX,fromY,toY,steps)
Delete