Dev.to
7/21/2026

Recording product demos with Playwright and no human
Short summary
The author built an automated product demo recorder using Playwright that drives a real Chrome instance end-to-end without human input. The core insight is replacing fixed timeouts with settle-detection — waiting for the DOM to go quiet via MutationObserver plus network idle — and modeling the recorder as an explicit state machine where every transition asserts its target state. This approach also yields free per-edge retries and produces demos with consistent pacing across machines, and the same settle strategy generalizes to more reliable end-to-end tests.
- •Replace fixed timeouts with settle-detection: wait for DOM mutations to stop plus network idle, with a hard maxMs ceiling for pages that never go quiet
- •Model the recorder as an explicit state machine with action-settle-assert transitions so failures are legible and flaky edges can retry individually
- •Layer intentional dwell time on top of settle-detection so demos read as human-paced while remaining machine-consistent
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



