Working With iOS Segments and Segmented Controls

Applies to TestComplete 14.40, last modified on April 22, 2021

In iOS applications, segmented controls allow you to select one of several options. Each option is represented by a segment - a button, which is part of the segmented control. The user can touch a segment to select it.

The image below demonstrates a sample segmented control containing three segments:

Segmented control in iOS application

To work with segmented controls in tests, use the iOS SegmentedControl test object. To work with individual segments, use the iOS Segment test object.

Note: The described support is available only if the tested iOS application and the computer where TestComplete is running have been prepared for testing in a special way. See Preparing Applications, Devices and Test Computers for iOS Testing.

TestComplete analyzes a control's class names in your tested application and automatically creates wrapper objects for the supported controls. The classes of the supported segments and segmented controls are listed in the project’s Object Mapping options. You can extend this list. For example, you can add the class name of a custom segmented control used in your tested application, and thus enable support for this control. For more information, see Object Mapping.

The iOS SegmentedControls and iOS Segment test objects provide access to native properties and methods of the underlying controls. They also provide specific properties and methods that can be used for simulating user actions on controls and for retrieving control data.

The topics in this section provide detailed information on working with segmented controls in TestComplete and contain sample scripts.

In This Section

Selecting a Segment

Describes how to select a segment.

Determining the Currently Selected Segment

Explains how to determine which segment is currently selected.

Determining a Segment's State

Explains how to determine a segment’s state.

Getting the Number of Segments in a Segmented Control

Describes how to determine the number of segments in a segmented control.

Getting a Segment's Text

Describes how to get a segment’s caption.

Related Topics of Interest

Testing iOS Applications

Describes the most common approaches for testing iOS applications.

See Also

iOS Segment Support
iOS SegmentedControl Support
Object-Specific Tasks
Supported Controls

Highlight search results