sandbox_scene
Runs JavaScript in the page a person has open at one of the box's URLs, on their own device, and returns the result.
| Input | Output |
|---|---|
id, js, timeoutSec |
result, pagesOpen |
Runs JavaScript in a page a person has open at one of the box's URLs, sceneUrl or a web service's url, on their own phone or laptop, and returns the value of the last expression; promises are awaited, so document.querySelector('#save').click() or location.pathname both work. HTML pages served through any of the box's URLs get a small script that connects back to the box (added to successful text/html responses and loaded from the page's own origin, /_sbx/bridge.js, so a Content-Security-Policy must allow scripts and WebSocket connections from 'self'); the call reaches the page most recently opened that way, whichever URL it came from (location.host says which), and pagesOpen says how many are connected. Checked on a box: a page opened at a web service's -8082 URL answered. That page is not on the box's display, so sandbox_shot and takeover input cannot reach it; this can. It fails with a clear message when no page is open. timeoutSec is how long to wait for the page to answer: default 15, at most 60.
Every tool and topic is listed in the tool reference.