Having gridView which has some images. The gridView\'s cell comes out from same predefined layout, which has same id and desc.
R.id.item_image == 2131
You should use onData() to operate on GridView:
onData()
GridView
onData(withId(R.id.item_image)) .inAdapterView(withId(R.id.grid_adapter_id)) .atPosition(0) .perform(click());
This code will click on the image inside first item in GridView