Skip to content

Instantly share code, notes, and snippets.

@mashhoodr
Created December 1, 2013 07:46
Show Gist options
  • Save mashhoodr/7729627 to your computer and use it in GitHub Desktop.
Save mashhoodr/7729627 to your computer and use it in GitHub Desktop.
Using DatePicker view in Calabash iOS [http://imars.info/using-datepicker-view-in-calabash-ios-ios6/]
def select_date(date_string)
date = Date.parse(date_string)
query("view:'_UIDatePickerView'", [{:selectRow => date.month - 1}, {:inComponent => 0}, {:animated => 1}])
query("view:'_UIDatePickerView'", [{:selectRow => date.day - 1},   {:inComponent => 1}, {:animated => 1}])
query("view:'_UIDatePickerView'", [{:selectRow => date.year - 1},  {:inComponent => 2}, {:animated => 1}])
sleep(0.4)
# the query does not create a UIControlEventValueChanged event, so we have to do a touch event
picker_scroll_up_on_column 0
sleep(0.4)
picker_scroll_down_on_column 0
sleep(0.4)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment