Trace Mode
Headless capture path — no DevTools UI window opens. At session end the adapter writes a trace-<sessionId>.zip (or trace-<sessionId>/ directory) next to your spec / config file. The artifact is portable and ships everything needed for offline replay, AI-agent diffing, or any consumer that prefers a file over a live UI.
Trace mode is mutually exclusive with live mode. Pick one per session: humans debugging interactively want live; agents diffing runs or CI bots collecting artifacts want trace.
Enable
// wdio.conf.ts
services: [
[
'devtools',
{
mode: 'trace',
traceFormat: 'zip' // optional; 'zip' (default) | 'ndjson-directory'
}
]
]
A complete, copy-pasteable reference config ships at examples/wdio/wdio.trace.conf.ts.
Selenium and Nightwatch ship the same trace pipeline — see their adapter pages for framework-specific enable syntax: Selenium · Nightwatch.
What's inside the artifact
| File | Contents |
|---|---|
trace.trace | NDJSON context-options + before / after action events; one line per record |
trace.network | HAR-style network entries, one per line |
transcript.md | Human/LLM-readable Markdown summary with timing, selectors, value annotations |
resources/page@<id>-<ts>.jpeg | Screenshot taken at each user-facing action |
resources/page@<id>-<ts>-elements.json | Flat list of interactable elements at that action |
resources/page@<id>-<ts>-snapshot.txt | Depth-indented accessibility-tree snapshot (AI-friendly) |
What counts as an "action"
Commands are filtered through an allow-list before they produce trace entries. Examples that land in the trace:
url/get→Page.navigateclick→Element.clicksetValue/sendKeys→Element.fillsubmit,clear,selectByVisibleText, …
Internal commands like findElement, waitUntil, executeScript are deliberately excluded — they don't represent user-facing intent and would noise up the timeline. The full allow-list lives in @wdio/devtools-core/action-mapping.ts.