docs: add browser click workflow example

This commit is contained in:
lda
2026-06-15 00:33:00 +07:00 Verified
parent 06bd1f36b4
commit 18df04101c
5 changed files with 54 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
# Browser Click Workflow Example
This example demonstrates a serial multi-node workflow over a trusted Python
source:
```text
open_click_page -> wait_for_click -> collect_snapshots
```
It opens a local HTML page with one visible button, captures a bounded JSON
snapshot before the click, performs a deterministic simulated click by default,
captures an after snapshot, closes the local server, and returns both snapshots
as workflow output.
The example deliberately avoids browser screenshots and base64 payloads. The
snapshots are small JSON objects suitable for CLI and LLM-agent output.
## Run
From the repository root:
```powershell
uv run wf config validate examples/browser_click_workflow/wf.config.json
uv run wf-rpc-server --config examples/browser_click_workflow/wf.config.json
```
In another terminal:
```powershell
uv run wf --config examples/browser_click_workflow/wf.config.json status
uv run wf --config examples/browser_click_workflow/wf.config.json cap list --source local.browser_click
```
The full artifact/deployment/run lifecycle is covered by:
```powershell
uv run pytest tests/examples/test_browser_click_workflow_example.py -q
```
## Manual Browser Mode
The checked-in test uses `"simulate": true` and `"open_browser": false`.
For manual experimentation, set `"open_browser": true` in the run input and
use `"simulate": false`; then click the button before `timeout_seconds` elapses.
Any browser or local server opened by the source is closed by the final
`collect_snapshots` node.