4

I have a date picker field where I want to set the dates (with a picker for Month, Day and Year with + and - for each field) but don't know how to do that in Robotium. I tried to use solo.setDatePicker(int, int, int, int), but the code complains that the setDatePicker is not a valid function for solo. Does anyone know how to do this? Thanks!

pixel
  • 24,905
  • 36
  • 149
  • 251
Char
  • 61
  • 1
  • 4

1 Answers1

8

I found this question while searching how to do this myself, and I tried the method you've cited in your question and it worked like a charm.

Here's my little code snippet:

    solo.clickOnText("Pick Date");
    solo.setDatePicker(0, 2012, 2, 16);
    solo.clickOnText("Set");

I'm guessing they added support to this method after you've tried it, I'm currently using Robotium 3.1 and it works really well. I simply click on the button that opens my DatePickerDialog, change the date and set it.

This also works for TimePickerDialog, just use .setTimePicker(0,10,0).

Jean-Philippe Roy
  • 4,752
  • 3
  • 27
  • 41