To check which segment is currently selected, use the
wSelectedItem property of the
iOS SegmentedControl object. This property returns the zero-based index of the selected item. The following example demonstrates how to use the property to obtain the index of the selected segment:
def Test(): # Select the iOS device Mobile.SetCurrent("iPhone") # Obtain the SegmentedControl object p = Mobile.Device().Process("SampleApp") segmentedControl = p.Window(0).TableView().SegmentedControl() # Obtain the index of the selected segment ind = segmentedControl.wSelectedItem Log.Message("The segmented with the index " + str(ind) + " is selected.")
To determine the currently selected segment from keyword tests, use the On-Screen Action or Call Object Method operation to access the properties described above. See Getting and Setting Object Property Values.