Click on a specific checkbox in a ListView using Espresso
问题 I have a ListView where each row has a checkbox: Now I want to click on the checkbox in the 4th row. I have the data model for each row, so I can easily use onData() to select a row with the given data. But how do I click on the checkbox in that row? 回答1: If your row layout allows clicking on the row to set the CheckBox, you can use this to click the ListView row: onData(anything()).atPosition(4).perform(click()); Otherwise you can click directly on the CheckBox without knowing its ID: onData