I’m new to Appium and I’m working on a test case for a native Android app. I need to determine if a checkbox is already checked or not. Here’s the code to find the checkbox.
AndroidElement clipBoardGetCheckBox = driver.findElementByXPath("//android.widget.LinearLayout[@index='1']/android.widget.LinearLayout[@index='2']/android.widget.CheckBox[@index='0']");
I’ve tried the following:
clipBoardGetCheckBox.getAttribute("checked")
clipBoardGetCheckBox.isEnabled()
clipBoardGetCheckBox.isSelected()
None of these seem to reliably tell me when the checkbox is both checked and unchecked. Am I doing something wrong or is there a better way to determine the state of a checkbox?