Amazon Developer

as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support
Skip to main content
The Appium Vega Driver supports the following World Wide Web Consortium (W3C) WebDriver commands:

find_element

The find_element command finds the first UI element that matches a specified selector strategy.
To use XPath with Appium Vega Driver, you can use the By.xpath() locator strategy.

Arguments

Common XPath expression components

A XPath expression includes the following components:
  • Axis - Specifies the direction of the search, such as descendant, ancestor, and following.
  • Node test - Specifies the node type to select, such as element, attribute, or text().
  • Predicate - Filters the selected nodes that are based on various conditions, such as attribute values, position, or custom functions.
The following example demonstrates the various components of a XPath expression:

find_elements

The find_elements command finds multiple UI elements, supports various locator strategies, and returns an array of elements, even if empty. Use this command for:
  • Iterating through lists
  • Verifying multiple controls
For optimal performance and reliability, use specific locator strategies and appropriate timeouts. In complex UI scenarios, use advanced techniques like hierarchical XPath.

Arguments

Comparison of find_element and find_elements

To locate a child element within the context of the parent element, find the enclosing element that contains the child elements.

click

The click command simulates clicking on a specific element at its center point. Although various locator strategies are available, clicking on elements by their ID provides a reliable and maintainable approach.

Arguments

The click command doesn’t require arguments as it operates on a previously located element.

Known limitations

The click() command may fail on devices connected to a video capture card instead of a real TV or monitor. The coordinate transformation between the automation toolkit and the display compositor can cause the touch event to land at incorrect coordinates. Workaround:
  • Use D-pad navigation (setFocus + pressKeyCode with DPAD_CENTER) instead of element.click().

send_keys

The send_keys command simulates typing text into an element and expects a string argument.

Arguments

Best practices:

  • Verify that the target element has focus and is ready to receive input.
  • Check element focus before sending keys. Use commands like click() to select the element before sending keys.
  • Add short delays between key sends as rapid or simultaneous input might cause issues on some devices or apps.

get_attribute

The get_attribute command retrieves the value of a specified attribute for a UI element.

Arguments

List of attributes

get_element_text

The get_element_text command retrieves the visible text content of a UI element. It returns the text that would be visible to the user, excluding any hidden text.

Arguments

The get_element_text command doesn’t require arguments as it operates on a previously located element.

Best practices:

  • Verify the element existence before attempting to get its text.
  • Handle potential empty text returns appropriately.
  • Consider text formatting and special characters in assertions.
  • Use with proper wait strategies when needed.

press_keycode

The press_keycode command simulates pressing a specific hardware key on the device. Use it with caution as it can impact app state and test flow. It accepts only numerical keycodes (no hexadecimal codes).

Arguments

tap

The tap command simulates tapping a specific set of coordinates on the screen. This command offers precise control over touch interactions but requires caution.

Arguments

Best practices:

Although tap offers fine-grained control, you should prioritize element-based interactions for test stability and maintainability. Use it only when element-based methods are impractical.

is_enabled

The is_enabled command checks the current state of a UI element. It returns true for enabled (interactive) and false for disabled (non-interactive).
Enabled elements allow user interaction. However, enabled doesn’t guarantee interactivity. Elements might function as enabled but lack visibility or have other interaction barriers. To validate interactivity, combine is_enabled with other commands like is_displayed.

Arguments

The is_enabled command doesn’t take arguments as it operates on a previously located element.

Best practices:

  • Use is_enabled as part of a comprehensive element state check.
  • Don’t rely on is_enabled to determine element interactivity.
  • Implement wait strategies before checking the element state.

is_displayed

The is_displayed command checks if a UI element is visible on the screen. It returns true for visible and false for hidden.
An element becomes visible when it appears within the screen boundaries.

Arguments

The is_displayed command doesn’t take arguments as it operates on a previously located element.

Best practices:

  • Use is_displayed as part of a comprehensive element state check.

implicitly_wait

The implicitly_wait command sets how long the driver waits when searching for unavailable elements. Although this command enhances test stability, use it with caution. For complex scenarios, combine implicitly_wait with explicit waits to balance reliability and execution speed.
For detailed implementation, see Set Implicit Wait Time.

Arguments

Best practices:

  • Set implicitly_wait at the start of the test.
  • Reset to a reasonable default (for example, 0 ms) when necessary.

get_window_rect

The get_window_rect command retrieves the size and position of the current app window relative to the overall screen size. Example: Python
Java
Where:
  • x - left coordinate of the window
  • y- top coordinate of the window
  • width - width of the window
  • height - height of the window

Arguments

No arguments are required.

Best practices:

Use get_window_rect with other commands to create robust test scripts that handle varying screen sizes and layouts.

get_page_source

The get_page_source command retrieves the current page source of the app, which represents the underlying UI structure. Python
Java

Arguments

The get_page_source command doesn’t require any arguments.

get_screenshot

The get_screenshot command captures the current app state as a base64-encoded string. Consider user privacy when using this command. Don’t capture digital rights management (DRM) content. Python
Java
For a complete list of methods and examples, see the Appium documentation.

Arguments

No arguments are required for this command.

install_app

The install_app command installs an app on the device. The VPKG file path must be available on the host’s (appium server) filesystem. Use this command at the beginning of the test to automate environment setup. Example: Python:
Java:

Arguments

activate_app

The activate_app command launches or brings to the foreground a specified app on the device. This command is useful for testing app switching scenarios or confirms a specific app is active before performing further test actions. Example: Python:
Java:

Arguments

Best practices

To get the correct appId for launching the app, run vpm list applications.

terminate_app

The terminate_app command stops the currently running app. Use this command when testing app behavior during forced closures or creating a clean state between test cases. Example:

Arguments

remove_app

The remove_app command uninstalls an app from the device. Example:

Arguments

execute_script

The execute_script command runs shell commands or invokes jsonrpc APIs. To execute shell commands on the device: appium_driver.execute_script("shell", "echo hello world") # To invoke jsonrpc APIs not exposed in Appium public interface: appium_driver.execute_script("jsonrpc: getScreenContext", "")

push_file

The push_file command lets you to transfer files directly to a device. You must provide the file content as a base64-encoded string. Use cases include uploading test data, configuration files, or any other files needed during test execution. Python:
Java:

Arguments

pull_file

The pull_file command lets you transfer files directly from a device. The command returns the file content as a base64-encoded string. Use cases include downloading test results, configuration files, or any other files needed during and after test execution. Python:
Java:

Arguments

D-pad navigation

The execute_script function sends Linux input event codes through the jsonrpc: injectInputKeyEvent method. This functionality lets your app simulate user input events programmatically for automation and testing. The function runs specified commands and key events within a script, enabling D-pad navigation in apps designed for directional pad input. The table lists the input event codes. For a comprehensive list of defined keycodes, see input event codes. The reference for input event codes helps create accessible and usable keyboard experiences. Support for specific keycodes varies by device type and input configuration. Test keyboard input handling for non-standard keyboard layouts or behaviors. Use the following command for injectInputKeyEvent:
For example, use the following command to navigate down.

Last modified on August 21, 2026