Skip to content

Pilot

pilot

Pilot

Bases: Generic[ReturnType]

Pilot object to drive an app.

app: App[ReturnType] property

click(selector=None, offset=Offset(), shift=False, meta=False, control=False) async

Simulate clicking with the mouse.

Parameters:

Name Type Description Default
selector type[Widget] | str | None

The widget that should be clicked. If None, then the click will occur relative to the screen. Note that this simply causes a click to occur at the location of the widget. If the widget is currently hidden or obscured by another widget, then the click may not land on it.

None
offset Offset

The offset to click within the selected widget.

Offset()
shift bool

Click with the shift key held down.

False
meta bool

Click with the meta key held down.

False
control bool

Click with the control key held down.

False

exit(result) async

Exit the app with the given result.

Parameters:

Name Type Description Default
result ReturnType

The app result returned by run or run_async.

required

hover(selector=None, offset=Offset()) async

Simulate hovering with the mouse cursor.

Parameters:

Name Type Description Default
selector type[Widget] | str | None | None

The widget that should be hovered. If None, then the click will occur relative to the screen. Note that this simply causes a hover to occur at the location of the widget. If the widget is currently hidden or obscured by another widget, then the hover may not land on it.

None
offset Offset

The offset to hover over within the selected widget.

Offset()

pause(delay=None) async

Insert a pause.

Parameters:

Name Type Description Default
delay float | None

Seconds to pause, or None to wait for cpu idle.

None

press(*keys) async

Simulate key-presses.

Parameters:

Name Type Description Default
*keys str

Keys to press.

()

wait_for_animation() async

Wait for any current animation to complete.

wait_for_scheduled_animations() async

Wait for any current and scheduled animations to complete.