- Use it for apps with animations, page transitions, or content that loads after a click.
- It’s off by default. Without it, the next command runs as soon as the action is sent.
- It can also wait for network traffic in the sandbox to die down.
Turn it on
Passredraw: true when you create the client:
tests/search.test.mjs
focusApplication() call now waits for the screen to settle.
What it waits for
TestDriver takes a small screenshot right before the action, then one every 500 ms after it. The screen counts as settled when both of these are true:- The screen changed. A frame differs from the “before” screenshot by more than 0.1% of its pixels.
- The screen stopped changing. The latest frame differs from the previous one by less than 0.1%, or by less than the average of the last 10 frames.
Wait for network traffic too
Setthresholds.network to also wait until the sandbox’s network traffic drops below its recent average:
thresholds: { screen: false, network: true }.
Options
boolean | object
default:"false"
true turns on screen detection. Pass an object to choose what to wait for.Older tests may use
redrawThreshold, or diffThreshold, screenRedraw, and networkMonitor inside redraw. They still work, but are deprecated. Use redraw with thresholds instead.Override it for one command
The client’s action methods accept aredraw object as an option. It applies to that call only:
testdriver.click(), hover(), type(), pressKeys(), scroll(), and focusApplication().
- Pass an object. A per-command
redraw: trueorredraw: falseis ignored. - Element methods such as
element.click()don’t take options. They always use the client’s setting.
Watch it work
Redraw emits two events on the client’s event emitter:redraw:statuson every check, with the current screen and network state.redraw:completewhen the wait ends, withisTimeoutandtimeElapsed.
When to use it
Turn redraw on when:- Clicks open pages, modals, or menus that animate in.
- Scrolling loads more content.
- Typing triggers autocomplete or validation messages.
- Your tests already pass reliably without it. Each action takes longer with it on.
- Many actions don’t visibly change the screen.
- You already wait with
find()and atimeout, which keeps looking until the element appears.
Related
- Options: every client option
- Events: the full list of events
- wait(): pause for a fixed time
- Locate elements: wait for an element to appear with
find()

