Class ActionDefinition

java.lang.Object
io.github.jspinak.brobot.dsl.ActionDefinition

public class ActionDefinition extends Object
Defines a sequence of actions as data in the Brobot Domain-Specific Language.

ActionDefinition represents a declarative specification of automation steps that can be stored, transmitted, and executed dynamically. It encapsulates a series of ActionSteps, each containing the configuration and targets for a specific action. This data-driven approach enables flexible automation definition without hardcoded logic.

Key features:

  • Sequential Steps: Maintains an ordered list of actions to execute
  • Data-driven: Can be serialized to/from JSON for configuration-based automation
  • Composable: Steps can be added dynamically to build complex workflows
  • Self-contained: Each step includes both action configuration and target objects

Common use patterns:

  • Defining state transitions as a series of actions
  • Creating reusable automation sequences
  • Building dynamic workflows from configuration files
  • Enabling non-programmers to define automation through data

Example workflow:

 Step 1: Find and click login button
 Step 2: Type username
 Step 3: Type password  
 Step 4: Click submit
 Step 5: Verify main page appears
 

In the model-based approach, ActionDefinition bridges the gap between abstract state transitions and concrete action sequences. It enables state transitions to be defined declaratively, making the automation more maintainable and allowing runtime modification of behavior without code changes.

The custom toString() implementation provides human-readable output for debugging and logging, showing each step in the sequence with its configuration.

Since:
1.0
See Also: