Drive a sandboxed cross-origin iframe via postMessage — frameLocator cannot reach it
A sandboxed iframe with an opaque (cross-origin) origin can only be reached via window.postMessage — frameLocator cannot pierce it
The frame below is rendered from a srcdoc with sandbox="allow-scripts" and deliberately no allow-same-origin. The browser therefore gives it an opaque origin (it reports "null"), so the parent cannot query its DOM — the only channel is postMessage.
The contract is a three-step handshake: ready → ping → pong. The frame announces wcq-ready on load; you send wcq-ping with a nonce; it replies with wcq-pong echoing the nonce plus a computed value.
Wait for ready, send a ping, observe the pong value
Note the reported origin is "null" — the opaque sandbox has no real origin, which is exactly why DOM piercing fails and shape validation matters.
Automation hints
frameLocator("#xo-frame") cannot find any inner selector; do not try to assert on elements inside the framewindow.postMessage and validate event.data shape (type + nonce); a sandboxed frame reports event.origin === "null", so assert the contract, not a same-origin URL — see #frame-originwcq-ready (gates #handshake-state[data-ready=true]), then click #send-ping, then read the wcq-pong result#handshake-state[data-ready] and #frame-value (or its data-value) — never on inner-frame selectors#send-ping button is disabled until the frame is ready, so wait for ready before driving the ping in your test