Package io.github.jspinak.brobot.fluent
Class ActionSequenceBuilder
java.lang.Object
io.github.jspinak.brobot.fluent.ActionSequenceBuilder
Fluent API builder for creating DSL-compatible action sequences.
This builder allows developers to programmatically create automation sequences that are fully compatible with the Brobot DSL. Each method call creates ActionStep objects that are added to an internal TaskSequence.
Example usage:
// Assuming userField, passwordField, submitButton are StateImage objects // and username, password are StateString objects InstructionSet loginSequence = Brobot.buildSequence() .withName("login") .find(userField) .thenClick() .thenType(username) .find(passwordField) .thenClick() .thenType(password) .find(submitButton) .thenClick() .build();
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddCustomAction
(ActionConfig options, ObjectCollection objects) Adds a custom action with full control over options and objects.build()
Builds the final InstructionSet containing the automation function.Builds and returns just the TaskSequence without wrapping in InstructionSet.declareTaskSequence
(String variableName) Creates a variable declaration statement for the task sequence.find
(StateImage target) Adds a find action to the sequence.Adds a click action on the last found object.thenDragTo
(StateImage target) Adds a drag action from the last found object to a target.thenHighlight
(StateImage target, double seconds) Adds a highlight action to visually mark regions on screen.thenScroll
(ScrollOptions.Direction direction, int times) Adds a scroll action.thenType
(StateString stateString) Adds a type action with a StateString.thenWaitVanish
(StateImage target) Adds a vanish action to wait for an object to disappear.withDescription
(String description) Sets the description for the automation function.Sets the name for the automation function.
-
Constructor Details
-
ActionSequenceBuilder
public ActionSequenceBuilder()
-
-
Method Details
-
withName
Sets the name for the automation function. -
withDescription
Sets the description for the automation function. -
find
Adds a find action to the sequence. The found object becomes the target for subsequent actions. -
thenClick
Adds a click action on the last found object. -
thenType
Adds a type action with a StateString. -
thenDragTo
Adds a drag action from the last found object to a target. This creates the 6 chained actions: Find→Find→MouseMove→MouseDown→MouseMove→MouseUp -
thenHighlight
Adds a highlight action to visually mark regions on screen. -
thenWaitVanish
Adds a vanish action to wait for an object to disappear. -
thenScroll
Adds a scroll action. -
addCustomAction
Adds a custom action with full control over options and objects. -
declareTaskSequence
Creates a variable declaration statement for the task sequence. -
build
Builds the final InstructionSet containing the automation function. -
buildTaskSequence
Builds and returns just the TaskSequence without wrapping in InstructionSet.
-