Debugging
eval
Execute JavaScript in the browser and return the result. Supports async/await expressions.
Usage
$ cdpilot eval <js>Arguments
| Name | Required | Description |
|---|---|---|
js | required | JavaScript expression to evaluate |
Examples
Get the page title
$ npx cdpilot eval "document.title"Count all links on the page
$ npx cdpilot eval "document.querySelectorAll('a').length"Fetch an API endpoint and return JSON
$ npx cdpilot eval "await fetch('/api/health').then(r=>r.json())"