The following commands are expected to be executed for either switch elements or button elements under Segmented controls.
- Assert UI element is selected element
- Assert UI element is not selected element
- Wait until UI element is selected element
- Wait until UI element is not selected element
- Store selected state
- If UI element is selected element
- If UI element is not selected element
Therefore, if any of the other kinds of element is specified, this error will be displayed.
Look for a switch element or a button element under segmented control
First, look for a switch element or a button element under segmented control that can be selected.
Switch elements have the following characteristics.
- UI element name: "***" switch
- Locator:
- -ios class chain: Anything ending with XCUIElementTypeSwitch
e.g. -ios class chain=**/XCUIElementTypeSwitch[1]
- XPath: Ending with XCUIElementTypeSwitch
e.g. (//XCUIElementTypeCell)[1]/XCUIElementTypeSwitch[1]
- -ios class chain: Anything ending with XCUIElementTypeSwitch
- Example
Button elements under segmented control have the following characteristics.
- Locator:
- -ios class chain: Anything ending with XCUIElementTypeSegmentedControl[1]/XCUIElementTypeButton
e.g. -ios class chain=**/XCUIElementTypeTable[1]/XCUIElementTypeCell[2]/XCUIElementTypeSegmentedControl[1]/XCUIElementTypeButton[1]
- XPath: Ending with XCUIElementTypeSegmentedControl[1]/XCUIElementTypeButton
e.g. (//XCUIElementTypeTable)[1]/XCUIElementTypeCell[2]/XCUIElementTypeSegmentedControl[1]/XCUIElementTypeButton[1]
- -ios class chain: Anything ending with XCUIElementTypeSegmentedControl[1]/XCUIElementTypeButton
- Example: The red rectangle below illustrates the example of a Button element under segmented control. In addition to the Button, there are 2 Button element2 under segmented control located on the right side of the red rectangles.
If a switch element or a button element under segmented control is found, specify the UI element to the command. If it doesn't find, please consider using another command such as "Assert UI element's attribute satisfies condition" or "Wait until UI element's attribute satisfies condition."