Skip to main content
Real apps move, load, and change. Adapt your tests to handle it. Once you’ve generated and learned your tests and gotten them running, the next challenge is the real world: buttons appear after a spinner, pages navigate, animations play, and content streams in over the network. To keep tests reliable, you need to perform the right actions and handle timing so your tests adapt to how the UI actually behaves instead of breaking.

Performing Actions

TestDriver provides a variety of actions you can perform, like clicking, typing, hovering, and scrolling. For a full list, see the API Reference.

Chaining Actions

TestDriver supports method chaining for cleaner code:
Or save element reference for later use:

Waiting for Dynamic Content

By default, find() automatically polls for up to 10 seconds, retrying every 5 seconds until the element is found. This means most elements that appear after short async operations will be found without any extra configuration. For longer operations, increase the timeout:

Flake Prevention

TestDriver automatically waits for the screen and network to stabilize after each action using redraw detection. This prevents flaky tests caused by animations, loading states, or dynamic content updates.
Redraw detection adds a small delay after each action but significantly reduces test flakiness.
For example, when clicking a submit button that navigates to a new page:
Without redraw detection, you’d need manual waits or retries to handle the page transition. TestDriver handles this automatically by detecting when the screen stops changing and network requests complete. You can disable redraw detection or customize its behavior:
Here is an example of customizing redraw detection:

Simple Delays with wait()

For simple pauses — waiting for animations, transitions, or state changes after an action — use wait():
For waiting for specific elements to appear, prefer find() with a timeout option. Use wait() only for simple time-based pauses.
Once your tests can reliably act on a changing UI and assert the results, the next step is figuring out what happened when something does go wrong.

Next: Debug

Use screenshots and run output to see exactly what your test saw and pinpoint failures.