Join our Newsletter — 33% off our NHI Course
Home› Glossary› Foundations & NHI Taxonomy› iOS Predicate String
Foundations & NHI Taxonomy

iOS Predicate String

← Back to Glossary
By NHI Mgmt Group Updated November 25, 2026 Domain: Foundations & NHI Taxonomy

An iOS predicate string is a query expression used in mobile test automation to locate interface elements by matching properties such as type, label, name, or value. It supports precise element selection in iOS automation and is often used with accessibility-based locators.

What the predicate string does in iOS automation

An iOS predicate string is a compact query language for finding interface elements by matching properties such as type, label, name, value, or visibility-related attributes. In test automation, it gives teams a precise way to target the right control when an app exposes stable accessibility metadata, which makes automated UI checks more reliable and less brittle than index-based selectors.

Why predicate strings are useful for element selection

Predicate strings are most valuable when the test must narrow a broad UI tree to one specific element without relying on screen position. They support expressive matching, so a test can describe the element it wants instead of hard-coding where it appears. That matters in mobile apps where layouts shift across devices, locales, and OS versions.

Because predicate strings depend on properties surfaced through the accessibility layer, their quality is only as good as the app’s accessible naming and labeling. When labels are inconsistent or duplicated, the selector may become ambiguous, and the automation may bind to the wrong element or fail to find it at all.

How predicate strings fit into accessibility-based locators

Predicate strings sit in the broader family of accessibility-driven locators, which aim to identify elements in the same way a user or assistive technology would perceive them. That usually makes them stronger than purely visual coordinates and often more maintainable than fragile XPath-style traversals. They are especially helpful when tests need to locate buttons, fields, lists, or cells by semantic attributes rather than by hierarchy alone.

The trade-off is that accessibility metadata becomes part of the test contract. If a developer renames a label, changes a value format, or removes an accessibility identifier-equivalent property, the selector can break even when the screen still looks correct to a human tester. Good automation therefore depends on disciplined app instrumentation as much as on the query syntax itself.

Common failure modes and selection mistakes

The main failure modes are selector ambiguity, over-specific matching, and reliance on transient text. A predicate that is too broad can match multiple elements, while one that is too narrow can fail whenever the UI copy or state changes. This is why predicate strings work best when they anchor on stable properties and only use dynamic values when the application design truly requires it.

They can also hide quality problems in the app under test. If teams repeatedly need complex predicates to locate basic controls, that often signals weak accessibility naming, inconsistent component design, or poor testability. In practice, the selector is often revealing a UI governance issue, not just a test-automation issue.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

NIST SP 800-53 Rev 5, OWASP ASVS and CIS Controls v8 set the technical controls, while ISO/IEC 27001:2022 defines the regulatory obligations.

FrameworkControl / ReferenceRelevance
NIST SP 800-53 Rev 5IA-2 — Identification and Authentication (Organizational Users)Predicate-based UI access testing often verifies authenticated user flows.
Recommendation — Validate interactive flows under authenticated sessions and confirm element access matches intended user states.
OWASP ASVSV13 — ConfigurationPredicate strings depend on stable app configuration and exposed UI properties.
Recommendation — Keep UI metadata and accessibility selectors consistent so automated tests remain stable.
CIS Controls v8CIS-16 — Application Software SecurityAutomation selectors are part of application testability and secure engineering practices.
Recommendation — Review application UI components for testable, stable, and accessibility-friendly element identifiers.
ISO/IEC 27001:2022A.8.28 — Secure codingUI locator stability reflects engineering discipline in application construction.
Recommendation — Build UI elements with durable, accessible properties that support maintainable automated testing.

Practitioner Guidance

Why practitioners should care: Predicate strings are a useful locator choice when teams need reliable, semantics-based UI targeting in iOS automation. They tend to produce tests that are easier to read and less brittle than coordinate-driven approaches, provided the app exposes consistent accessibility properties.

Common misunderstanding: A more complex predicate is not automatically a better selector. If the query has to inspect many changing attributes to work, it is usually compensating for unstable app metadata rather than expressing a well-designed locator strategy.

Practitioner takeaway: Treat predicate strings as a sign that accessibility quality and testability are part of the same engineering problem, not separate concerns.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on November 25, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org