I am trying to get the status of Checkbox using androidviewclient
lock = vc.findViewWithText('Lock SIM card')
if (lock.isChecked()):
print "Enabled"
else:
print "Disabled"
this always returns False .
can anybody tell me how to get the status of checkbox
That's because lock is not the ckeckbox. Lock is the text view containing "Lock SIM card". You need to use hierarchyviewer or uiautomatorviewer to see the layout of the UI.
The UI looks something like:
So you need to do something like:
It's not straight forward, but I used this in the past and worked. Please note that the ViewClient version that I used was 2.3. Now it has evolved to 4+.
This might work:
This Link Has what you want The example above will show you how to obtain status of the selected checkbox. Check it out.