Skip to content

Actions

lotus64 edited this page Jun 17, 2026 · 1 revision

Actions Reference

Volt provides a wide range of actions you can use within the steps array of your YAML scripts.

Navigation & Interaction

navigate

Navigates the browser to a specific URL.

  • Parameters: url
  • Example:
- action: navigate
  url: "https://example.com"

click

Clicks on an element matching the selector.

  • Parameters: selector
  • Example:
- action: click
  selector: "button#submit"

type

Fills a text input with the provided value.

  • Parameters: selector, value
  • Example:
- action: type
  selector: "input[name='email']"
  value: "test@example.com"

press_key

Simulates pressing a keyboard key on a specific element.

  • Parameters: selector, value (e.g. "Enter", "Tab", "Escape")
  • Example:
- action: press_key
  selector: "input[name='q']"
  value: "Enter"

hover

Hovers the mouse over an element.

  • Parameters: selector
  • Example:
- action: hover
  selector: ".dropdown-menu"

check / uncheck

Checks or unchecks a checkbox or radio button.

  • Parameters: selector
  • Example:
- action: check
  selector: "#agree-terms"

select

Selects an option in a <select> dropdown.

  • Parameters: selector, value (value of the option)
  • Example:
- action: select
  selector: "select#country"
  value: "FR"

upload

Uploads a file to an input element of type file.

  • Parameters: selector, file (path to the file)
  • Example:
- action: upload
  selector: "input[type='file']"
  file: "./assets/image.png"

scroll

Scrolls the page to a specific element or to the top/bottom.

  • Parameters: selector OR value ("top" or "bottom")
  • Example:
- action: scroll
  value: "bottom"

Control Flow

loop

Repeats a set of actions based on a start and end index.

  • Parameters: from, to, do (array of steps)
  • Example:
- action: loop
  from: 1
  to: 3
  do:
    - action: log
      message: "Iteration {{loop.index}}"

for_each

Iterates over a list of items and performs actions for each.

  • Parameters: for_each (array of items), iterator (variable name), do (array of steps)
  • Example:
- action: for_each
  iterator: item
  for_each:
    - "apple"
    - "banana"
  do:
    - action: log
      message: "Current item: {{item}}"

if

Executes specific steps conditionally based on a JavaScript expression.

  • Parameters: condition, then (array of steps), else (array of steps)
  • Example:
- action: if
  condition: "true"
  then:
    - action: log
      message: "Condition is true!"
  else:
    - action: log
      message: "Condition is false!"

Waiting & Assertions

wait

Pauses execution for a specified number of seconds.

  • Parameters: duration (integer)
  • Example:
- action: wait
  duration: 3

wait_visible / wait_hidden

Waits until an element becomes visible or hidden.

  • Parameters: selector
  • Example:
- action: wait_visible
  selector: ".loading-spinner"

assert_visible / assert_hidden

Fails the script if the element is not currently visible/hidden.

  • Parameters: selector
  • Example:
- action: assert_visible
  selector: "#success-message"

assert_text

Fails the script if the text content of the element doesn't exactly match the value.

  • Parameters: selector, value
  • Example:
- action: assert_text
  selector: "h1"
  value: "Welcome"

assert_eval

Fails the script if the provided JavaScript expression does not evaluate to true.

  • Parameters: value (JS expression)
  • Example:
- action: assert_eval
  value: "document.title.includes('Dashboard')"

Data Extraction

scrape

Extracts structured data from the page and saves it as JSON.

  • Parameters: scrape (object with parent and fields), name (optional variable name to store)
  • Example:
- action: scrape
  name: "products"
  scrape:
    parent: ".product-item"
    fields:
      title: ".title"
      price: ".price"
      url: "a@href" # Use @ to get attributes

store_value

Stores a literal value in a state variable.

  • Parameters: name, as (value)
  • Example:
- action: store_value
  name: "my_var"
  as: "123"

store_text

Extracts text from an element and saves it to a variable.

  • Parameters: selector, name
  • Example:
- action: store_text
  selector: ".username"
  name: "current_user"

store_attribute

Extracts an attribute from an element and saves it to a variable.

  • Parameters: selector, attribute, name
  • Example:
- action: store_attribute
  selector: "a.link"
  attribute: "href"
  name: "link_url"

store_eval

Evaluates a JavaScript expression and saves the result to a variable.

  • Parameters: value (JS expression), name
  • Example:
- action: store_eval
  value: "window.location.href"
  name: "current_url"

Miscellaneous

log

Prints a message to the console.

  • Parameters: message
  • Example:
- action: log
  message: "Hello world"

screenshot

Takes a screenshot of the page or a specific area.

  • Parameters: pathname (optional), position (optional)
  • Example:
- action: screenshot
  pathname: "./screenshots/page.png"

clear_cookies

Clears all browser cookies.

  • Example:
- action: clear_cookies

set_header / add_header / remove_header

Modifies the HTTP headers sent with browser requests.

  • Parameters: name, value (for set/add)
  • Example:
- action: set_header
  name: "Authorization"
  value: "Bearer token"