Documentation
¶
Overview ¶
Package activity provides the activity system for RPA workflow execution.
Index ¶
- Variables
- func GetBool(params map[string]any, key string) bool
- func GetFloat(params map[string]any, key string) float64
- func GetInt(params map[string]any, key string) int
- func GetIntDefault(params map[string]any, key string, defaultValue int) int
- func GetMap(params map[string]any, key string) map[string]any
- func GetString(params map[string]any, key string) string
- func GetStringDefault(params map[string]any, key, defaultValue string) string
- func GetStringSlice(params map[string]any, key string) []string
- func List() []string
- func Register(a Activity)
- type Activity
- type AssertActivity
- type CheckActivity
- type ClickActivity
- type Environment
- type FileDeleteActivity
- type FileExistsActivity
- type FileReadActivity
- type FileWriteActivity
- type FillActivity
- type FindActivity
- type FindAllActivity
- type GetAttributeActivity
- type GetTextActivity
- type GetValueActivity
- type HTTPDownloadActivity
- type HTTPGetActivity
- type HTTPPostActivity
- type IsVisibleActivity
- type LogActivity
- type NavigateActivity
- type PDFActivity
- type Registry
- func (r *Registry) Categories() []string
- func (r *Registry) Count() int
- func (r *Registry) Get(name string) (Activity, bool)
- func (r *Registry) List() []string
- func (r *Registry) ListByCategory() map[string][]string
- func (r *Registry) ListCategory(category string) []string
- func (r *Registry) MustGet(name string) Activity
- func (r *Registry) Register(a Activity)
- type ScrapeTableActivity
- type ScreenshotActivity
- type ScrollActivity
- type SelectOptionActivity
- type SetVariableActivity
- type TypeActivity
- type UncheckActivity
- type WaitActivity
- type WaitForActivity
Constants ¶
This section is empty.
Variables ¶
var DefaultRegistry = NewRegistry()
DefaultRegistry is the global default registry.
Functions ¶
func GetIntDefault ¶
GetIntDefault retrieves an integer parameter with a default value.
func GetStringDefault ¶
GetStringDefault retrieves a string parameter with a default value.
func GetStringSlice ¶
GetStringSlice retrieves a string slice parameter from the params map.
Types ¶
type Activity ¶
type Activity interface {
// Name returns the activity's unique identifier (e.g., "browser.navigate").
Name() string
// Execute runs the activity with the given parameters and environment.
Execute(ctx context.Context, params map[string]any, env *Environment) (any, error)
}
Activity represents an executable RPA action.
type AssertActivity ¶
type AssertActivity struct{}
AssertActivity asserts a condition is true.
func (*AssertActivity) Execute ¶
func (a *AssertActivity) Execute(ctx context.Context, params map[string]any, env *Environment) (any, error)
func (*AssertActivity) Name ¶
func (a *AssertActivity) Name() string
type CheckActivity ¶
type CheckActivity struct{}
CheckActivity checks a checkbox.
func (*CheckActivity) Execute ¶
func (a *CheckActivity) Execute(ctx context.Context, params map[string]any, env *Environment) (any, error)
func (*CheckActivity) Name ¶
func (a *CheckActivity) Name() string
type ClickActivity ¶
type ClickActivity struct{}
ClickActivity clicks on an element.
func (*ClickActivity) Execute ¶
func (a *ClickActivity) Execute(ctx context.Context, params map[string]any, env *Environment) (any, error)
func (*ClickActivity) Name ¶
func (a *ClickActivity) Name() string
type Environment ¶
type Environment struct {
// Pilot is the browser automation interface.
Pilot *w3pilot.Pilot
// Variables contains workflow and step variables.
Variables map[string]any
// WorkDir is the working directory for file operations.
WorkDir string
// Logger is the structured logger for activity output.
Logger *slog.Logger
// Headless indicates if the browser is running in headless mode.
Headless bool
}
Environment provides execution context to activities.
func NewEnvironment ¶
NewEnvironment creates a new Environment with initialized fields.
type FileDeleteActivity ¶
type FileDeleteActivity struct{}
FileDeleteActivity deletes a file.
func (*FileDeleteActivity) Execute ¶
func (a *FileDeleteActivity) Execute(ctx context.Context, params map[string]any, env *Environment) (any, error)
func (*FileDeleteActivity) Name ¶
func (a *FileDeleteActivity) Name() string
type FileExistsActivity ¶
type FileExistsActivity struct{}
FileExistsActivity checks if a file exists.
func (*FileExistsActivity) Execute ¶
func (a *FileExistsActivity) Execute(ctx context.Context, params map[string]any, env *Environment) (any, error)
func (*FileExistsActivity) Name ¶
func (a *FileExistsActivity) Name() string
type FileReadActivity ¶
type FileReadActivity struct{}
FileReadActivity reads a file's contents.
func (*FileReadActivity) Execute ¶
func (a *FileReadActivity) Execute(ctx context.Context, params map[string]any, env *Environment) (any, error)
func (*FileReadActivity) Name ¶
func (a *FileReadActivity) Name() string
type FileWriteActivity ¶
type FileWriteActivity struct{}
FileWriteActivity writes content to a file.
func (*FileWriteActivity) Execute ¶
func (a *FileWriteActivity) Execute(ctx context.Context, params map[string]any, env *Environment) (_ any, err error)
func (*FileWriteActivity) Name ¶
func (a *FileWriteActivity) Name() string
type FillActivity ¶
type FillActivity struct{}
FillActivity fills an input with a value (clears first).
func (*FillActivity) Execute ¶
func (a *FillActivity) Execute(ctx context.Context, params map[string]any, env *Environment) (any, error)
func (*FillActivity) Name ¶
func (a *FillActivity) Name() string
type FindActivity ¶
type FindActivity struct{}
FindActivity finds an element by selector.
func (*FindActivity) Execute ¶
func (a *FindActivity) Execute(ctx context.Context, params map[string]any, env *Environment) (any, error)
func (*FindActivity) Name ¶
func (a *FindActivity) Name() string
type FindAllActivity ¶
type FindAllActivity struct{}
FindAllActivity finds all elements matching a selector.
func (*FindAllActivity) Execute ¶
func (a *FindAllActivity) Execute(ctx context.Context, params map[string]any, env *Environment) (any, error)
func (*FindAllActivity) Name ¶
func (a *FindAllActivity) Name() string
type GetAttributeActivity ¶
type GetAttributeActivity struct{}
GetAttributeActivity gets an attribute value from an element.
func (*GetAttributeActivity) Execute ¶
func (a *GetAttributeActivity) Execute(ctx context.Context, params map[string]any, env *Environment) (any, error)
func (*GetAttributeActivity) Name ¶
func (a *GetAttributeActivity) Name() string
type GetTextActivity ¶
type GetTextActivity struct{}
GetTextActivity gets the text content of an element.
func (*GetTextActivity) Execute ¶
func (a *GetTextActivity) Execute(ctx context.Context, params map[string]any, env *Environment) (any, error)
func (*GetTextActivity) Name ¶
func (a *GetTextActivity) Name() string
type GetValueActivity ¶
type GetValueActivity struct{}
GetValueActivity gets the value of an input element.
func (*GetValueActivity) Execute ¶
func (a *GetValueActivity) Execute(ctx context.Context, params map[string]any, env *Environment) (any, error)
func (*GetValueActivity) Name ¶
func (a *GetValueActivity) Name() string
type HTTPDownloadActivity ¶
type HTTPDownloadActivity struct{}
HTTPDownloadActivity downloads a file.
func (*HTTPDownloadActivity) Execute ¶
func (a *HTTPDownloadActivity) Execute(ctx context.Context, params map[string]any, env *Environment) (any, error)
func (*HTTPDownloadActivity) Name ¶
func (a *HTTPDownloadActivity) Name() string
type HTTPGetActivity ¶
type HTTPGetActivity struct{}
HTTPGetActivity performs an HTTP GET request.
func (*HTTPGetActivity) Execute ¶
func (a *HTTPGetActivity) Execute(ctx context.Context, params map[string]any, env *Environment) (any, error)
func (*HTTPGetActivity) Name ¶
func (a *HTTPGetActivity) Name() string
type HTTPPostActivity ¶
type HTTPPostActivity struct{}
HTTPPostActivity performs an HTTP POST request.
func (*HTTPPostActivity) Execute ¶
func (a *HTTPPostActivity) Execute(ctx context.Context, params map[string]any, env *Environment) (any, error)
func (*HTTPPostActivity) Name ¶
func (a *HTTPPostActivity) Name() string
type IsVisibleActivity ¶
type IsVisibleActivity struct{}
IsVisibleActivity checks if an element is visible.
func (*IsVisibleActivity) Execute ¶
func (a *IsVisibleActivity) Execute(ctx context.Context, params map[string]any, env *Environment) (any, error)
func (*IsVisibleActivity) Name ¶
func (a *IsVisibleActivity) Name() string
type LogActivity ¶
type LogActivity struct{}
LogActivity logs a message.
func (*LogActivity) Execute ¶
func (a *LogActivity) Execute(ctx context.Context, params map[string]any, env *Environment) (any, error)
func (*LogActivity) Name ¶
func (a *LogActivity) Name() string
type NavigateActivity ¶
type NavigateActivity struct{}
NavigateActivity navigates to a URL.
func (*NavigateActivity) Execute ¶
func (a *NavigateActivity) Execute(ctx context.Context, params map[string]any, env *Environment) (any, error)
func (*NavigateActivity) Name ¶
func (a *NavigateActivity) Name() string
type PDFActivity ¶
type PDFActivity struct{}
PDFActivity generates a PDF of the page.
func (*PDFActivity) Execute ¶
func (a *PDFActivity) Execute(ctx context.Context, params map[string]any, env *Environment) (any, error)
func (*PDFActivity) Name ¶
func (a *PDFActivity) Name() string
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds all available activities.
func (*Registry) Categories ¶
Categories returns all activity categories.
func (*Registry) ListByCategory ¶
ListByCategory returns activities grouped by category (prefix before ".").
func (*Registry) ListCategory ¶
ListCategory returns all activities in a specific category.
type ScrapeTableActivity ¶
type ScrapeTableActivity struct{}
ScrapeTableActivity extracts data from an HTML table.
func (*ScrapeTableActivity) Execute ¶
func (a *ScrapeTableActivity) Execute(ctx context.Context, params map[string]any, env *Environment) (any, error)
func (*ScrapeTableActivity) Name ¶
func (a *ScrapeTableActivity) Name() string
type ScreenshotActivity ¶
type ScreenshotActivity struct{}
ScreenshotActivity captures a screenshot.
func (*ScreenshotActivity) Execute ¶
func (a *ScreenshotActivity) Execute(ctx context.Context, params map[string]any, env *Environment) (any, error)
func (*ScreenshotActivity) Name ¶
func (a *ScreenshotActivity) Name() string
type ScrollActivity ¶
type ScrollActivity struct{}
ScrollActivity scrolls the page or an element.
func (*ScrollActivity) Execute ¶
func (a *ScrollActivity) Execute(ctx context.Context, params map[string]any, env *Environment) (any, error)
func (*ScrollActivity) Name ¶
func (a *ScrollActivity) Name() string
type SelectOptionActivity ¶
type SelectOptionActivity struct{}
SelectOptionActivity selects an option in a dropdown.
func (*SelectOptionActivity) Execute ¶
func (a *SelectOptionActivity) Execute(ctx context.Context, params map[string]any, env *Environment) (any, error)
func (*SelectOptionActivity) Name ¶
func (a *SelectOptionActivity) Name() string
type SetVariableActivity ¶
type SetVariableActivity struct{}
SetVariableActivity sets a variable value.
func (*SetVariableActivity) Execute ¶
func (a *SetVariableActivity) Execute(ctx context.Context, params map[string]any, env *Environment) (any, error)
func (*SetVariableActivity) Name ¶
func (a *SetVariableActivity) Name() string
type TypeActivity ¶
type TypeActivity struct{}
TypeActivity types text into an element (without clearing).
func (*TypeActivity) Execute ¶
func (a *TypeActivity) Execute(ctx context.Context, params map[string]any, env *Environment) (any, error)
func (*TypeActivity) Name ¶
func (a *TypeActivity) Name() string
type UncheckActivity ¶
type UncheckActivity struct{}
UncheckActivity unchecks a checkbox.
func (*UncheckActivity) Execute ¶
func (a *UncheckActivity) Execute(ctx context.Context, params map[string]any, env *Environment) (any, error)
func (*UncheckActivity) Name ¶
func (a *UncheckActivity) Name() string
type WaitActivity ¶
type WaitActivity struct{}
WaitActivity waits for a specified duration.
func (*WaitActivity) Execute ¶
func (a *WaitActivity) Execute(ctx context.Context, params map[string]any, env *Environment) (any, error)
func (*WaitActivity) Name ¶
func (a *WaitActivity) Name() string
type WaitForActivity ¶
type WaitForActivity struct{}
WaitForActivity waits for an element to reach a state.
func (*WaitForActivity) Execute ¶
func (a *WaitForActivity) Execute(ctx context.Context, params map[string]any, env *Environment) (any, error)
func (*WaitForActivity) Name ¶
func (a *WaitForActivity) Name() string