Action Flow
📖 Description
The flow in a script is a sequence of actions executed for each target from the context.
It defines what must be done, in which order, and how to handle the results. Each action is an independent step: navigation, extracting text, waiting, checking conditions, logging, and other atomic operations.
🧩 Flow Structure
The flow property in the script is an array of action objects (NavaAction
).
Actions are executed sequentially for each target. You can combine any actions to automate your scenario.
📋 Example
{ "flow": [ { "action": "log", "message": "Starting Google test!", "style": "italic yellow" }, { "action": "navigate" }, { "action": "log", "message": "Navigation done!" }, { "action": "js", "resultName": "PageTitle", "script": "return document.title;" }, { "action": "saveToFile", "includeLog": true } ] }
This sample flow performs the following:
1. Logs: "Starting Google test!".
2. Opens the Google page (URL comes from the context).
3. Logs: "Navigation done!".
4. Executes JS to get the title (`document.title`) and stores it as "PageTitle".
5. Saves results and logs into results.jsonl.
🧩 Base Action Fields
Each action inherits from the base structure (NavaAction
).
It defines shared fields. Specific types may extend it with their own parameters and logic.
Field | Type | Required | Description | Default value |
---|---|---|---|---|
type |
NavaActionType | Action type (required), e.g., "navigate", "log", "js". | ||
name |
string | Action name (optional). | ||
description |
string | Short description (optional). | ||
breakFlowOnError |
bool | Stops the flow on error (default: false). | false | |
breakScriptOnError |
bool | Stops the entire script on error (default: false). | false | |
preJs |
JsCodeSpec | JavaScript to run on the page before the action. | ||
postJs |
JsCodeSpec | JavaScript to run on the page after the action. | ||
preHostJs |
JsCodeSpec | JavaScript to run in the host before the action (advanced use). | ||
postHostJs |
JsCodeSpec | JavaScript to run in the host after the action (advanced use). | ||
initStore |
NavaActionInitStore | Initial values for script, flow, and page stores. |
📖️ Execution Stores
Three separate stores are used during execution:
Script — global variables available throughout the script.
Flow — values relevant to the current flow (action chain).
Page — variables and results for the current page or tab.
These stores allow data exchange between actions and reuse of intermediate results.
Within actions, blocks like JsCodeSpec
can read/write from these stores, enabling result preservation and flow continuity.
Field | Type | Required | Description |
---|---|---|---|
script |
Dictionary<string, object> | Global script variables (shared across flows and pages). | |
flow |
Dictionary<string, object> | Variables within one flow (between actions for a single target). | |
page |
Dictionary<string, object> | Variables and results associated with the current page or tab. |
Action Types
Multiple action types are supported (e.g., navigate
, log
, js
, saveToFile
, etc.). Each has its own parameters and use case.
📖 JsCodeSpec
JsCodeSpec
is an object that defines JavaScript code to be executed in the browser or host at specific stages of the action.
The code can be provided in one of the following forms:
▪️ inline
— JavaScript code written directly in the script
▪️ file
— path to an external JS file (relative to the script directory)
Field | Type | Required | Description | Default value |
---|---|---|---|---|
inline |
string | Inline JavaScript code (directly in script) | ||
file |
string | Path to JS file (relative to the script folder) |