Skip to content

Codegen reference

Use this page to look up options, the action mapping, and limits. For the workflow, see Generate a script from a recording.

Terminal window
vibium codegen -i <recording.zip> [options]
OptionPurposeExample
-i, --inputRecording zip to read (required)vibium codegen -i record.zip
-l, --languageScript language: javascript (default) or pythonvibium codegen -i record.zip -l python
-o, --outputSave the script as a new file instead of printing itvibium codegen -i record.zip -o replay.mjs
--jsonPrint the script in the CLI JSON envelopevibium codegen -i record.zip --json

Codegen reads the zip offline. It launches no browser and needs no daemon or AI configuration. The input MUST be a trace format version 8 zip — a Vibium recording or a Playwright trace. --output never replaces an existing file. An unknown --language is an error.

JavaScript output uses top-level await, so it MUST run as an ES module: save it as .mjs or run it in a "type": "module" package. Python output uses the sync API and runs as a plain script.

OutcomeExit code
Script generated0
Invalid input, unknown language, existing output file, or read failure1

Recorded actions map to client calls. Element actions re-find their target with the exact recorded locator — CSS selector or semantic keys (role, text, label, placeholder, alt, title, testid, xpath, near). A recorded nth-match index becomes findAll(...)[n] (find_all(...)[n]). Consecutive actions on the same locator share one element variable.

Recorded actionJavaScriptPython
Page.navigatevibe.go(url)vibe.go(url)
Page.reload / back / forwardvibe.reload() …vibe.reload() …
Page.screenshotvibe.screenshot()vibe.screenshot()
Page.setViewportvibe.setViewport({ width, height })vibe.set_viewport({'width': …, 'height': …})
Page.evalvibe.evaluate(expr)vibe.evaluate(expr)
Page.setContentvibe.setContent(html)vibe.set_content(html)
Page.waitForURL / waitForLoad / waitForFunction / waitvibe.waitForURL(pattern) …vibe.wait_for_url(pattern) …
Page.scrollvibe.scroll(direction, amount)vibe.scroll(direction, amount)
Element.click / dblclick / hover / focus / tap / clear / unset / scrollIntoViewvibe.find(loc).click() …vibe.find(loc).click() …
Element.fill / type / press / selectOptionvibe.find(loc).fill(value) …vibe.find(loc).fill(value) …
Element.setvibe.find(loc).set() or .set(false).set() or .set(False)
Element.dragTo.dragTo(await vibe.find(target)).drag_to(vibe.find(target))
Element.setFiles.setFiles([...]).set_files([...])
Element.dispatchEvent.dispatchEvent(type, init).dispatch_event(type, init)
Element.waitFor.waitUntil(state).wait_until(state)
Page.keyboard.* / mouse.* / touch.*vibe.keyboard.press(key) …vibe.keyboard.press(key) …
Action group// group: <title># group: <title>
  • Pure queries change nothing on replay and are omitted: Element.text, isVisible, getAttribute, Page.title, Page.url, and the other getters, plus bare find/findAll calls.
  • Noise and internal operations are omitted: Element.highlight, recording control, Run, and Check operations, and raw BiDi commands.
  • An action whose recorded result was an error becomes a comment: // skipped failed action: Element.click (<message>).
  • An unmapped action becomes a comment: // skipped unsupported action: ….
  • Screenshots, DOM snapshots, and network events carry no action to replay.
  • The script drives one page. Recordings of multi-page flows replay every action on the first page.
  • Recorded timeouts are dropped; replay uses the client defaults.
  • Redacted values replay literally: a password recorded as [REDACTED] is typed as [REDACTED]. Edit the script before running it.
  • Skipped getters mean the script replays actions, not assertions. Add your own checks, or verify the replay with vibium check.