QPilot Best Practices Guide — Mobile (Android & iOS)
Supported actions, reference examples, and do's & don'ts for Android and iOS testing
Supported Actions — Mobile
| Action | Common | Android | iOS |
|---|---|---|---|
| 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
| Action | Description | Example Step |
|---|---|---|
| CLICK | Clicks/taps a button, link, or any tappable element | Click the Login button |
| TAP | Touch tap — preferred for native touch targets | Tap the Accept button |
| INPUT_TEXT | Types text into an input field | Enter john@email.com in the email field |
| CLEAR_TEXT | Clears existing content from a field | Clear the search input field |
| GET_TEXT | Captures the text of an element for later assertion | Get the text of the order confirmation number |
| WAIT | Pauses execution for a set duration | Wait for 3 seconds |
| MOVE_SLIDER | Adjusts a slider to a target value | Move the price range slider to 500 |
| DRAG_DROP | Drags an element and drops it on a target | Drag the product card and drop it into the wishlist |
| SCREENSHOT | Captures a screenshot at that point | Take a screenshot of the screen |
| SCROLL_UP | Scrolls the screen upward | Scroll up to the top of the page |
| SCROLL_DOWN | Scrolls the screen downward | Scroll down |
| SLIDE_RIGHT | Swipes right — for carousels or onboarding | Slide right on the onboarding screen |
| SLIDE_LEFT | Swipes left — for dismissal or navigation | Slide left to dismiss the notification |
| APP_CONTROL_BACK | Presses the device back button (Android only) | Press back |
| APP_CONTROL_HOME | Returns to the device home screen | Press the Home button |
| APP_CONTROL_CLOSE | Closes the application | Close the app |
| APP_CONTROL_RELAUNCH | Closes and restarts the app from scratch | Relaunch the app |
| APP_CONTROL_SWITCH_APP | Switches to another app in the background | Switch to the SMS app |
| APP_CONTROL_HIDE_KEYBOARD | Dismisses the on-screen keyboard | Hide keyboard |
| SWITCH_TO_NATIVE_CONTEXT | Explicitly switches to native app context | Switch to Native context |
| SWITCH_TO_WEBVIEW_CONTEXT | Explicitly switches to WebView context | Switch to WebView context |
| IS_DISPLAYED | Checks if an element is visible on screen | Check if the Add to cart button is displayed |
| IS_ENABLED | Checks if an element is interactable | Check if the Submit button is enabled |
| ASSERT | Validates an expected condition — fails on mismatch | Assert that the confirmation message says Order Placed |
| IS_TEXT_PRESENT | Checks if a text string is present on screen | Validate 'Mobile Number is incorrect' text is present |
Mobile — Do's and Don'ts
✅ DO's
| # | Do | Example |
|---|---|---|
| 1 | Be specific about the element — use the visible label, placeholder, or on-screen text | Click the 'Set as current store' button |
| 2 | Paste multiple steps at once — QPilot processes bulk input and queues steps sequentially | Paste 5–10 steps together in the input bar |
| 3 | Use TAP for native touch elements and CLICK for standard interactive controls | Tap the toggle switch to enable notifications |
| 4 | Use test data variables with {{key}} syntax for any value that may change between runs | Enter {{N1}} in the Mobile Number field |
| 5 | Use SCREENSHOT at key checkpoints such as after login or order placement | Take a screenshot of the order summary screen |
| 6 | Use ASSERT or IS_TEXT_PRESENT to validate outcomes rather than only performing actions | Assert that the welcome message reads Hello John |
| 7 | Use SCROLL_DOWN before interacting with elements that may be below the fold | Scroll down then Click the Add to cart button |
| 8 | Use APP_CONTROL_HIDE_KEYBOARD after text input when the keyboard blocks the next element | Enter address in the street field → Hide keyboard |
| 9 | Use APP_CONTROL_RELAUNCH to test cold start or reset app state between test scenarios | Relaunch the app |
| 10 | Switch back to Native context after interacting with a WebView in hybrid apps | Switch to Native context |
| 11 | Retrieve Frame Information | Identify and obtain the list of available frames present on the page |
| 12 | Switch to the Target Frame | Before performing any operation on an element inside a frame, the automation context must explicitly switch to the specific frame that contains the target element. |
| 13 | Perform the Required Action | Once the driver context is inside the correct frame, interact with the element (e.g., click, input text, retrieve attributes). |
| 14 | Reset the Frame Context | After completing the action, the frame context must be reset (e.g., switch back to the default content). |
| 15 | Switching to Another Frame | If 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't | Instead |
|---|---|---|
| 1 | Don't use vague element references | ❌ Click the button → ✅ Click the Checkout button |
| 2 | Don't add unnecessary explicit waits — QPilot intelligently waits for elements | Only use WAIT when a genuine delay is expected |
| 3 | Don't chain multiple actions into a single step | ❌ Enter email, click next, enter password → Write each separately |
| 4 | Don't forget CLEAR_TEXT before INPUT_TEXT if a field has pre-filled value | Clear the email field, then Enter new@email.com |
| 5 | Don't skip context switching in hybrid apps — WebView elements need SWITCH_TO_WEBVIEW_CONTEXT | Always use SWITCH_TO_WEBVIEW_CONTEXT first |
| 6 | Don't hardcode test data directly when data varies per run | ❌ Enter 9876543210 → ✅ Enter {{phone}} in the phone field |
| 7 | Don't use SLIDE_RIGHT/LEFT for simple scrolling | Use SCROLL_UP / SCROLL_DOWN instead |
| 8 | Don't omit APP_CONTROL_HIDE_KEYBOARD on iOS when keyboard covers the next element | Add 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
Custom Step Timeout (Recommended)
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
| Mode | Use When | Example Step |
|---|---|---|
| Default (auto) | Element loads within ~10 seconds; standard interactions | Click the Login button |
| Explicit wait | A known fixed delay is expected (e.g., animation, transition) | Wait for 3 seconds |
| Custom timeout | Slow page loads, dynamic content, or external API calls | Step 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.
| Operation | Description | Example Step |
|---|---|---|
| Open new tab | Opens 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 position | Switches 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 name | Switches to the tab matching the given name, regardless of its position in the tab order. | Switch to Amazon tab |
| Close by name | Closes the tab with the specified name. Useful for cleaning up after completing work in a specific tab. | Close Amazon tab |
| Close by position | Closes the tab at the specified index position. Use when you want to manage resources and focus on a single page. | Close 2nd tab |
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.
| Command | Description | Example Step |
|---|---|---|
| SCROLL_UP | Scrolls the screen upward. Supported on both Android and iOS. | Scroll up to the top of the page |
| SCROLL_DOWN | Scrolls the screen downward. Supported on both Android and iOS. | Scroll down |
| Scroll until element visible | Scrolls 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 pixels | Scrolls by a precise pixel amount. Use for fine-grained control of the viewport position. | Scroll by 100px |
| Scroll by percentage | Scrolls 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 / bottom | Jumps the viewport to the very top or very bottom of the page in a single step. | Scroll to the bottom |
| Scroll multiple times | Repeats 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?