Skip to main content
Documentation|Qpilot Best Practices Mobile

QPilot Best Practices Guide — Mobile (Android & iOS)

Supported actions, reference examples, and do's & don'ts for Android and iOS testing

Supported Actions — Mobile

ActionCommonAndroidiOS
CLICK
INPUT_TEXT
CLEAR_TEXT
GET_TEXT
WAIT
SET_DATE
SWITCH_CONTEXT
GET_CONTEXTS
MOVE_SLIDER
DRAG_DROP
SCREENSHOT
APP_CONTROL_BACK
APP_CONTROL_CLOSE
APP_CONTROL_RELAUNCH
APP_CONTROL_HOME
APP_CONTROL_SWITCH_APP
APP_CONTROL_HIDE_KEYBOARD
IS_DISPLAYED
ASSERT
IS_ENABLED
IS_TEXT_PRESENT
SLIDE_RIGHT
SLIDE_LEFT
SWITCH_TO_NATIVE_CONTEXT
SWITCH_TO_WEBVIEW_CONTEXT
SCROLL_UP
SCROLL_DOWN
TAP

Mobile Action Reference & Examples

ActionDescriptionExample Step
CLICKClicks/taps a button, link, or any tappable elementClick the Login button
TAPTouch tap — preferred for native touch targetsTap the Accept button
INPUT_TEXTTypes text into an input fieldEnter john@email.com in the email field
CLEAR_TEXTClears existing content from a fieldClear the search input field
GET_TEXTCaptures the text of an element for later assertionGet the text of the order confirmation number
WAITPauses execution for a set durationWait for 3 seconds
MOVE_SLIDERAdjusts a slider to a target valueMove the price range slider to 500
DRAG_DROPDrags an element and drops it on a targetDrag the product card and drop it into the wishlist
SCREENSHOTCaptures a screenshot at that pointTake a screenshot of the screen
SCROLL_UPScrolls the screen upwardScroll up to the top of the page
SCROLL_DOWNScrolls the screen downwardScroll down
SLIDE_RIGHTSwipes right — for carousels or onboardingSlide right on the onboarding screen
SLIDE_LEFTSwipes left — for dismissal or navigationSlide left to dismiss the notification
APP_CONTROL_BACKPresses the device back button (Android only)Press back
APP_CONTROL_HOMEReturns to the device home screenPress the Home button
APP_CONTROL_CLOSECloses the applicationClose the app
APP_CONTROL_RELAUNCHCloses and restarts the app from scratchRelaunch the app
APP_CONTROL_SWITCH_APPSwitches to another app in the backgroundSwitch to the SMS app
APP_CONTROL_HIDE_KEYBOARDDismisses the on-screen keyboardHide keyboard
SWITCH_TO_NATIVE_CONTEXTExplicitly switches to native app contextSwitch to Native context
SWITCH_TO_WEBVIEW_CONTEXTExplicitly switches to WebView contextSwitch to WebView context
IS_DISPLAYEDChecks if an element is visible on screenCheck if the Add to cart button is displayed
IS_ENABLEDChecks if an element is interactableCheck if the Submit button is enabled
ASSERTValidates an expected condition — fails on mismatchAssert that the confirmation message says Order Placed
IS_TEXT_PRESENTChecks if a text string is present on screenValidate 'Mobile Number is incorrect' text is present

Mobile — Do's and Don'ts

✅ DO's

#DoExample
1Be specific about the element — use the visible label, placeholder, or on-screen textClick the 'Set as current store' button
2Paste multiple steps at once — QPilot processes bulk input and queues steps sequentiallyPaste 5–10 steps together in the input bar
3Use TAP for native touch elements and CLICK for standard interactive controlsTap the toggle switch to enable notifications
4Use test data variables with {{key}} syntax for any value that may change between runsEnter {{N1}} in the Mobile Number field
5Use SCREENSHOT at key checkpoints such as after login or order placementTake a screenshot of the order summary screen
6Use ASSERT or IS_TEXT_PRESENT to validate outcomes rather than only performing actionsAssert that the welcome message reads Hello John
7Use SCROLL_DOWN before interacting with elements that may be below the foldScroll down then Click the Add to cart button
8Use APP_CONTROL_HIDE_KEYBOARD after text input when the keyboard blocks the next elementEnter address in the street field → Hide keyboard
9Use APP_CONTROL_RELAUNCH to test cold start or reset app state between test scenariosRelaunch the app
10Switch back to Native context after interacting with a WebView in hybrid appsSwitch to Native context
11Retrieve Frame InformationIdentify and obtain the list of available frames present on the page
12Switch to the Target FrameBefore performing any operation on an element inside a frame, the automation context must explicitly switch to the specific frame that contains the target element.
13Perform the Required ActionOnce the driver context is inside the correct frame, interact with the element (e.g., click, input text, retrieve attributes).
14Reset the Frame ContextAfter completing the action, the frame context must be reset (e.g., switch back to the default content).
15Switching to Another FrameIf another frame interaction is required, the automation must first switch back to the default context and then switch to the new target frame. Attempting to switch directly from one frame to another without resetting the context may lead to execution failures.

❌ DON'Ts

#Don'tInstead
1Don't use vague element references❌ Click the button → ✅ Click the Checkout button
2Don't add unnecessary explicit waits — QPilot intelligently waits for elementsOnly use WAIT when a genuine delay is expected
3Don't chain multiple actions into a single step❌ Enter email, click next, enter password → Write each separately
4Don't forget CLEAR_TEXT before INPUT_TEXT if a field has pre-filled valueClear the email field, then Enter new@email.com
5Don't skip context switching in hybrid apps — WebView elements need SWITCH_TO_WEBVIEW_CONTEXTAlways use SWITCH_TO_WEBVIEW_CONTEXT first
6Don't hardcode test data directly when data varies per run❌ Enter 9876543210 → ✅ Enter {{phone}} in the phone field
7Don't use SLIDE_RIGHT/LEFT for simple scrollingUse SCROLL_UP / SCROLL_DOWN instead
8Don't omit APP_CONTROL_HIDE_KEYBOARD on iOS when keyboard covers the next elementAdd Hide keyboard after text entry before tapping

Waits & Timeouts

QPilot automatically waits up to 10 seconds for any element to become interactable before executing an action. This built-in wait covers most scenarios without requiring any explicit instruction. For situations where a longer or more precise delay is needed, QPilot supports two additional wait modes.

Explicit Wait

Use a plain-language instruction to pause execution for a fixed duration. This is useful when a known delay exists — for example, after a form submission or before a transition completes. Example: Wait for 5 seconds

For slow-loading pages, dynamic content, or external API calls, set a custom timeout directly on the step. This overrides the default 10-second limit for that specific step only and can be set up to 300 seconds. To set a custom timeout: click the step menu → select Step Timeout → enter the required value (in seconds).

When to use each mode

ModeUse WhenExample Step
Default (auto)Element loads within ~10 seconds; standard interactionsClick the Login button
Explicit waitA known fixed delay is expected (e.g., animation, transition)Wait for 3 seconds
Custom timeoutSlow page loads, dynamic content, or external API callsStep menu → Step Timeout → set 30 seconds

Tab Management

QPilot supports multi-tab test flows using plain-language instructions. You can open new tabs, switch between them by name or position, and close them when no longer needed — all without writing any code.

OperationDescriptionExample Step
Open new tabOpens the specified URL in a new browser tab. After opening, you must explicitly switch context to the new tab before interacting with it.Open amazon.com in a new tab
Switch by positionSwitches focus to the tab at the given index. Tab index starts at 1 in the order they were opened.Switch to 2nd tab
Switch by nameSwitches to the tab matching the given name, regardless of its position in the tab order.Switch to Amazon tab
Close by nameCloses the tab with the specified name. Useful for cleaning up after completing work in a specific tab.Close Amazon tab
Close by positionCloses the tab at the specified index position. Use when you want to manage resources and focus on a single page.Close 2nd tab
info

Always switch context after opening a new tab

Opening a new tab does not automatically move test focus to it. You must explicitly add a switch step immediately after — for example, Switch to Amazon tab — otherwise all subsequent actions will continue executing in the original tab.

Scrolling

QPilot supports a range of scroll commands for both fixed and dynamic pages. Use SCROLL_UP and SCROLL_DOWN for standard mobile scrolling. For web-based flows requiring precise or relative scrolling, the following commands are available.

CommandDescriptionExample Step
SCROLL_UPScrolls the screen upward. Supported on both Android and iOS.Scroll up to the top of the page
SCROLL_DOWNScrolls the screen downward. Supported on both Android and iOS.Scroll down
Scroll until element visibleScrolls until the specified element appears in the viewport. Use for elements that are initially off-screen. (Web only)Scroll until the Submit button is visible
Scroll by pixelsScrolls by a precise pixel amount. Use for fine-grained control of the viewport position.Scroll by 100px
Scroll by percentageScrolls by a percentage of the current page height. Useful for relative scrolling in dynamic or variable-length pages.Scroll by 20 percent
Scroll to top / bottomJumps the viewport to the very top or very bottom of the page in a single step.Scroll to the bottom
Scroll multiple timesRepeats the scroll action a specified number of times. Helpful for infinite scroll pages or loading dynamic content progressively.Scroll down 3 times

Did this page help you?