Actions
Actions drive the app: type into a field, toggle a switch, pick a date, tap a button, swipe a
list. They are methods on the Locator a getBy* returns (see
Writing tests for locating elements). Every action
auto-waits for the element to be visible and actionable before it runs, and accepts an optional
{ timeout } to override the default (see Timeouts).
This page is the task-by-task guide. The terse method tables live in Writing tests.
Text input
fill focuses the field, clears it, and sends the text as real key events, so React Native and
Flutter onChangeText handlers fire:
import { test, expect } from '@taqwright/taqwright';
test('sign in', async ({ mobile }) => {
await mobile.getByLabel('Username').fill('emma@demoapp.com');
await mobile.getByLabel('Password').fill('10203040');
await mobile.getByLabel('Login').click();
await expect(mobile.getByLabel('View All')).toBeVisible();
});
clear empties a field. When an autocomplete or search-as-you-type needs to react to each
keystroke, use pressSequentially, which sends one character at a time with an optional delay:
await mobile.getByLabel('Search').clear();
await mobile.getByLabel('Search').pressSequentially('boho', { delay: 100 });
Checkboxes and switches
check and uncheck are idempotent: they only act if the control is not already in the wanted
state, so they are safe to call unconditionally. Read the current state with isChecked:
await mobile.getById('darkMode').check();
await mobile.getById('darkMode').uncheck();
const on = await mobile.getById('darkMode').isChecked();
Native pickers
selectOption drives native pickers, spinners, and date/time pickers. It auto-detects the control
type from the element and accepts several input shapes:
// Spinner / dropdown menu: pick by label (a bare string is shorthand for { label }).
await mobile.getByType('android.widget.Spinner').selectOption('Large');
await mobile.getByType('android.widget.Spinner').selectOption({ label: 'Large' });
// Picker wheel: pick by 0-indexed row.
await mobile.getByType('XCUIElementTypePickerWheel').selectOption({ index: 2 });
// Date picker: ISO date.
await mobile.getByType('XCUIElementTypeDatePicker').selectOption({ date: '2026-05-14' });
// Time picker: 24-hour time.
await mobile.getByType('XCUIElementTypeDatePicker').selectOption({ time: '09:30' });
Tap and press
click (and its alias tap) waits for the element to be visible and enabled, then taps it.
doubleClick / doubleTap taps twice, and longPress presses and holds (default 1000 ms):
await mobile.getByLabel('Add to Cart').click();
await mobile.getByText('Map').doubleTap();
await mobile.getByText('Message').longPress({ duration: 1500 });
When you need a raw coordinate tap instead of an element, the mobile fixture taps a point or a
percentage of a box:
await mobile.click({ x: 540, y: 1200 });
await mobile.clickByPercent({ x: 0, y: 0, width: 1080, height: 2400 }, 0.5, 0.9);
Keys and hardware buttons
press sends a single named key to the focused element. Supported keys include Enter, Tab,
Backspace, Space, the arrows, and Escape (plus Home / End / PageUp / PageDown where
the platform supports them):
await mobile.getByLabel('Search').fill('boho');
await mobile.getByLabel('Search').press('Enter');
press takes one named key at a time. Desktop-style modifier combinations such as Control+A are
not available on mobile.
For device-level keys and hardware buttons, use the mobile fixture:
await mobile.press('Enter'); // device-level named key
await mobile.pressButton('BACK'); // HOME | BACK | POWER | VOLUME_UP | VOLUME_DOWN | ENTER
await mobile.goBack(); // Android back / iOS nav-bar back
Focus and the keyboard
focus brings an element into focus (opening the keyboard for inputs); blur dismisses it. You
can also control the soft keyboard directly:
await mobile.getByLabel('Notes').focus();
await mobile.getByLabel('Notes').blur();
if (await mobile.isKeyboardShown()) {
await mobile.hideKeyboard();
}
Gestures
Swipe inside an element's bounding box with the locator gestures, or swipe and scroll the whole
screen with the mobile fixture. Note mobile.swipe moves your finger in the named direction,
while mobile.scroll reveals content in that direction (the opposite finger movement):
// Element-scoped
await mobile.getByText('Wi-Fi').swipeLeft();
// Screen-level
await mobile.swipe('up');
await mobile.scroll('down');
// Bring an element into view (native scroll, gesture fallback)
await mobile.getByText('Submit').scrollIntoView();
await mobile.scrollIntoView(mobile.getByText('Submit'));
Drag, drop, and pinch round out the set:
await mobile.getByText('Card').dragTo(mobile.getByText('Done column'));
await mobile.dragAndDrop({ x: 100, y: 400 }, { x: 100, y: 120 });
await mobile.getByType('XCUIElementTypeImage').pinchOut(); // zoom in
await mobile.getByType('XCUIElementTypeImage').pinchIn(); // zoom out
Mobile has no form file-upload (setInputFiles), hover, right-click, or keyboard modifiers. To
place a file on the device storage, use mobile.pushFile. The broader device API (orientation,
clipboard, OS dialogs, app lifecycle) is covered in
Writing tests.