How do I select all checkboxes on the mobile screen without clicking each one

How do I select all checkboxes on the mobile screen without clicking each one

2 Likes

Hi,

Can you please try like this?

// Find the scrollable container element (replace with your element locator)
MobileElement scrollableContainer = MobileKeywords.findElement(FindTestObject('ScrollableContainer'))

// Loop through each checkbox and check them
List<MobileElement> checkboxes = scrollableContainer.findElements(By.className('android.widget.CheckBox'))
for (MobileElement checkbox in checkboxes) {
    checkbox.setSelected(true)
}