# Flow Control and Logic

- [Flow control and logic overview](https://docs.maestro.dev/maestro-flows/flow-control-and-logic/flow-control-and-logic-overview.md): Overview of flow control: conditions, loops, nested flows, and hooks.
- [How to use Selectors](https://docs.maestro.dev/maestro-flows/flow-control-and-logic/how-to-use-selectors.md): Learn to identify UI elements using text, ID, position, and state selectors.
- [Nested flows](https://docs.maestro.dev/maestro-flows/flow-control-and-logic/nested-flows.md): Reuse test logic by calling subflows from parent flows with runFlow.
- [Wait commands](https://docs.maestro.dev/maestro-flows/flow-control-and-logic/wait-commands.md): Control timing with wait commands for animations, network calls, and UI updates.
- [Loops](https://docs.maestro.dev/maestro-flows/flow-control-and-logic/loops.md): Repeat actions using the repeat command for iterative test scenarios.
- [Conditions](https://docs.maestro.dev/maestro-flows/flow-control-and-logic/conditions.md): Execute commands conditionally based on visibility, platform, or custom expressions.
- [Parameters and constants](https://docs.maestro.dev/maestro-flows/flow-control-and-logic/parameters-and-constants.md): Pass dynamic values to flows using CLI parameters and inline constants.
- [Specify and start devices](https://docs.maestro.dev/maestro-flows/flow-control-and-logic/specify-and-start-devices.md): Learn how to launch Android and iOS virtual devices using the Maestro CLI, identify connected hardware, and target specific devices for local testing.
- [Hooks](https://docs.maestro.dev/maestro-flows/flow-control-and-logic/hooks.md): Learn how to use onFlowStart and onFlowComplete hooks for setup and cleanup automation.
- [Test in different locales](https://docs.maestro.dev/maestro-flows/flow-control-and-logic/test-in-different-locales.md): Test your app in multiple languages and regions using locale configuration.
- [Locales supported by Maestro](https://docs.maestro.dev/maestro-flows/flow-control-and-logic/test-in-different-locales/locales-supported-by-maestro.md): Complete list of locale codes supported by Maestro for internationalization testing.
- [Permissions](https://docs.maestro.dev/maestro-flows/flow-control-and-logic/permissions.md): Configure app permissions on launch or mid-flow for iOS and Android testing.
- [Labeling and error handling](https://docs.maestro.dev/maestro-flows/flow-control-and-logic/labeling-and-error-handling.md): Configure label and optional in Maestro to improve test reporting, documentation, and resilient error handling for UI flows.
- [Detect Maestro](https://docs.maestro.dev/maestro-flows/flow-control-and-logic/detect-maestro.md): Detect when your app is running under Maestro automation for test-specific behavior.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.maestro.dev/maestro-flows/flow-control-and-logic.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
