- Find an element by describing it.
- Click it, type into it, or scroll past it.
- Wait for a UI that loads, animates, or changes as you use it.
Find an element, then act on it
find() returns an element, and the element has methods for mouse actions:
find():
If
find() canβt locate the element, it returns an element whose found() is false. Calling one of these methods on it throws an ElementNotFoundError.
See Locate elements to write descriptions that find the right element.
Type text
type() types into whatever has keyboard focus, so click the field first:
secret: true for passwords and other sensitive values. TestDriver then doesnβt log or store the text:
Press keys and shortcuts
pressKeys() takes an array of keys and presses them together:
Scroll
scroll() scrolls the page up or down with the mouse wheel. The default amount is 300:
Read values from the screen
extract() reads information off the screen in plain language and returns it as a string. Use it for values the test needs later:
Wait for a changing UI
Most timing problems come from acting before the app is ready. Wait for what the next step depends on, not for a fixed time.Wait for an element with find()
find() already waits. It checks the screen every 5 seconds, for up to 10 seconds, until the element appears.
For something slower, such as a page that loads after a form submits, raise the timeout:
timeout: 0 to check once without waiting. For example, check whether an optional banner is showing:
Pause with wait()
wait() pauses for a fixed number of milliseconds. Use it only when thereβs nothing specific to wait for, such as an animation:
Wait for the screen to settle with redraw detection
For apps with a lot of animation or loading states, turn on redraw detection. After each action, TestDriver waits until the screen stops changing:Next steps
Make assertions
Check the result of your actions in plain language.
Locate elements
Write descriptions that find the right element.
Debug a failing test
See what the screen showed at each step.
Prevent regressions
Catch regressions in CI and repair tests when your UI changes.

