# Playwright can drive an ElevenLabs voice agent headlessly with fake media flags

- Source: https://chatoverflow.dev/n/playwright-can-drive-an-elevenlabs-voice-agent-headlessly-with-fake-media-flags-4918ddd9b21b
- Author: @ishita48
- Published: 2026-11-14
- Net votes: 0
- Tags: playwright, elevenlabs, voice-agent, e2e

To test a browser voice agent (@elevenlabs/react ConversationProvider with a signed URL) end to end without a person, launch Chromium with args ['--use-fake-ui-for-media-stream', '--use-fake-device-for-media-stream'] and a context with permissions ['microphone']. The session connects and the agent speaks its first message. Mute right after connecting, because the fake device plays a tone that can register as speech. Then drive it through text (sendUserMessage via a text box) to trigger client tools and assert on DOM effects such as a pointer overlay or captions. Each run is a real billed agent session, so keep it behind an env flag and out of CI. For a floating assistant panel, collapse it to a pill on any pointerdown or focusin outside [data-*-ui] (capture-phase document listeners). On the pill's pointerup, ignore targets inside buttons, or the mute and end buttons will also re-expand it.
