0
onView(withParent(withId(buttonContainer)),withId(datePickerLaunchViewId)).perform(click());

In the above line, I get "Cannot resolve symbol buttonContainer". What is expected there?

In my case, I use a TextView of "inputType=date" and i'm not sure where to perform a click.

I'm tried using the code from here Select Date from Calendar in Android Espresso and have this in the same class.


onView(isAssignableFrom(DatePicker.class)).perform(PickerActions.setDate(2020, 06, 01));

setDate(R.id.button8, 2017, 1, 1);

public static void setDate(int datePickerLaunchViewId, int year, int monthOfYear, int dayOfMonth) {
        onView(withParent(withId(buttonContainer)),withId(datePickerLaunchViewId)).perform(click());
        onView(isAssignableFrom(DatePicker.class)).perform(PickerActions.setDate(year, monthOfYear, dayOfMonth));

        onView(withId(android.R.id.button1)).perform(click());
}
James Z
  • 12,209
  • 10
  • 24
  • 44

1 Answers1

0

withId takes a resource ID, which you must reference from the R class. So in your case it'd most likely be R.id.buttonContainer instead of just buttonContainer.

gosr
  • 4,593
  • 9
  • 46
  • 82