austgl / robotium

Automatically exported from code.google.com/p/robotium
0 stars 0 forks source link

How to change date for DatePicker #185

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
My app opens a DatePicker dialog when click on a button.
I have to change date after getting hold of DatePicker instance. I can invoke 
solo.getCurrentDatePickers() to retrieve the DatePicker. But how can I modify 
the date?

Currently I am doing the following:-

solo.clickOnText("Schedule start time");
solo.clickOnView((Button) solo
                .getView(com.ebay.mobile.R.id.button_date_schedule));
solo.waitForText("Set"); // This is to wait till the dataPicker dialog shows up
Log.d(CALL_NAME, Integer.toString(solo.getCurrentDatePickers().size()));        // 
size is returned as 1
solo.getCurrentDatePickers().get(0).updateDate(2012, 1, 25);
solo.clickOnButton("Set");

What is the expected output? What do you see instead?
Actual Result:- Throws error as "Only the original thread that created the view 
hierarchy can touch its views"
Expected Result:- The datePicker should pick the date as provided 2012-01-25

What version of the product are you using? On what operating system?
Robotium2.5

Please provide any additional information below.

Original issue reported on code.google.com by koneru.s...@gmail.com on 16 Nov 2011 at 4:12

GoogleCodeExporter commented 9 years ago
Please read the javadoc. You can use setDatePicker()!

Original comment by renasr...@gmail.com on 16 Nov 2011 at 5:53

GoogleCodeExporter commented 9 years ago
Got it, thank you. Don't know how I missed looking at this API..

Original comment by koneru.s...@gmail.com on 16 Nov 2011 at 3:33