Module: pipeline/actionDiscovery

Discovers actionable UI elements on a page and produces executable Action descriptors for the state explorer.

Builds on top of the existing element data captured by module:pipeline/pageSnapshot.takeSnapshot and the scoring logic in module:pipeline/elementFilter.scoreElement. Instead of just filtering elements for AI prompt context, this module determines what actions can be performed on each element.

Action types

Type Elements
click buttons, links, tabs, menu items, role="button"
fill text inputs, email, password, search, tel, number
select <select> dropdowns, role="combobox"
submit submit buttons, form submit actions
check checkboxes, radio buttons, switches

Exports

  • discoverActions(snapshot) → Action[]
  • generateTestData(field) → string
Source:

Methods

(static) detectSignupIntent(snapshot, formActions) → {boolean}

detectSignupIntent(snapshot, formActions) → boolean

Returns true if the given form actions appear to belong to a signup/registration flow that will likely require email verification. Checks:

  1. Submit/click button text on the form
  2. Page title / heading text in the snapshot
  3. Presence of both an email field AND a password field (strong signal)
Parameters:
Name Type Description
snapshot object

Page snapshot from takeSnapshot

formActions Array.<object>

Action descriptors for a single form group

Source:
Returns:
Type
boolean

(static) discoverActions(snapshot) → {Array.<{type: string, selectors: Array.<string>, element: object, value: (string|null), priority: number, isDestructive: boolean, formId: string}>}

Discover all actionable elements on a page and produce Action descriptors.

Parameters:
Name Type Description
snapshot object

— page snapshot from module:pipeline/pageSnapshot.takeSnapshot

Source:
Returns:

sorted by priority (highest first)

Type
Array.<{type: string, selectors: Array.<string>, element: object, value: (string|null), priority: number, isDestructive: boolean, formId: string}>

(static) generateTestData(field) → {string}

Generate a realistic test value for a form field based on its type, name, label, and placeholder.

Parameters:
Name Type Description
field object

— element descriptor from pageSnapshot

Source:
Returns:

a plausible test value

Type
string

(inner) buildSelectors(el, actionType) → {Array.<string>}

Build an ordered list of Playwright selector strings for an element. The explorer tries them in order; the first that resolves wins.

Parameters:
Name Type Description
el object

— element descriptor

actionType string
Source:
Returns:

selector strings

Type
Array.<string>

(inner) resolveActionType(el) → {string|null}

Determine the action type for an element based on its tag, type, and role.

Parameters:
Name Type Description
el object

— element descriptor from pageSnapshot

Source:
Returns:

action type or null if not actionable

Type
string | null

(inner) scoreAction(el, actionType) → {number}

Score an action for exploration priority. Higher = explore first.

Parameters:
Name Type Description
el object

— element descriptor

actionType string
Source:
Returns:

0–100

Type
number