Write Tests with Appium Vega Driver
The Appium Vega Driver enables automated testing of apps on Fire TV Stick. This page shows how to create automated tests using Python, Java, or JavaScript.
Prerequisites
- Complete the steps in Set Up Testing with Appium.
- Review Manage Appium Sessions for capabilities configuration.
-
Confirm if the Appium server is running on default port 4723:
curl http://localhost:4723/status
- Have a Vega-supported Fire TV device or Vega Virtual Device with a target app installed.
Write your test script
- Choose your preferred integrated development environment and programming language.
-
Create a new file with the following code snippet:
Python:
from appium import webdriver from appium.options.common import AppiumOptions bridge = "vda" desired_caps = { "platformName": "Vega", "appium:automationName": "automation-toolkit/JSON-RPC", "browserName": "", "kepler:device": f"{bridge}://default" # Or, replace 'default' with a Device Serial Number (DSN) } desired_caps = AppiumOptions().load_capabilities(desired_caps) appium_url = "http://127.0.0.1:4723" def appium_session(): driver = webdriver.Remote(appium_url, options=desired_caps) try: output = driver.execute_script("shell", 'echo "Hello World!"') if "Hello" in output: print(f"Execute script command run was successful:\n{output}") else: print("Something went wrong") finally: driver.quit() if __name__ == '__main__': appium_session()
JavaScript:
const {remote} = require('webdriverio'); const capabilities = { platformName: 'Vega', 'appium:automationName': 'automation-toolkit/JSON-RPC', 'kepler:device': 'vda://default', 'appium:appURL': 'com.amazon.keplervideoapp.main', }; const opts = { hostname: 'localhost', port: 4723, logLevel: 'info', capabilities, }; const test = async function runTest() { const driver = await remote(opts); try { const element = await driver.$('//children[@test_id="card169309"'); // getElementRect command const rect = await driver.getElementRect(element.elementId); console.log(`x: ${rect.x}, y: ${rect.y}, width: ${rect.width}, height: ${rect.height}`); } finally { await driver.deleteSession(); } } test().catch(console.error);
Java:
Java requires compilation and dependency management. Use Maven or Gradle to handle these requirements automatically.
Project setup using Maven
-
Check for
Maven
installation.mvn --version
-
Create a
pom.xml
in your project root.<project> <modelVersion>4.0.0</modelVersion> <groupId>com.amazon.akd</groupId> <artifactId>kepler-test</artifactId> <version>1.0-SNAPSHOT</version> <dependencies> <dependency> <groupId>io.appium</groupId> <artifactId>java-client</artifactId> <version>8.5.1</version> </dependency> </dependencies> </project>
-
Create a test class. See text class.
Project setup using Gradle
-
Verify
Gradle
installation:gradle --version
-
Create
build.gradle
in your project root:plugins { id 'java' id 'application' } repositories { mavenCentral() } dependencies { implementation 'io.appium:java-client:8.5.1' } application { mainClass = 'com.amazon.akd.commands.page_and_source.ExecuteScriptExample' }
-
Create
settings.gradle
.rootProject.name = 'kepler-test'
-
Create a test class. See text class.
-
Test class
package com.amazon.akd.commands.page_and_source;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.remote.options.BaseOptions;
import java.net.MalformedURLException;
import java.net.URL;
public class ExecuteScriptExample {
public static void main(String[] args) throws MalformedURLException {
BaseOptions options = new BaseOptions()
.setPlatformName("Vega")
.setAutomationName("automation-toolkit/JSON-RPC")
.amend("kepler:device", "vda://default")
.amend("appium:appURL", "com.amazon.keplervideoapp.main");
AppiumDriver driver = new AppiumDriver(
new URL("http://127.0.0.1:4723"), options
);
try {
// execute_script command
String output = driver.executeScript("shell", "echo 'Hello World!'").toString();
System.out.println(output);
} finally {
driver.quit();
}
}
}
Run your test script
You can run your test script using your preferred testing framework and tooling.
- Open a command prompt.
- Navigate to your test file location.
- Run the test.
Python:
python test.py
Example output:
$ python test.py
Execute script command run was successful:
Hello World!
JavaScript:
node test.js
Example output:
$ node test.js
{
x: 150,
y: 200,
width: 300,
height: 400
}
Java
Using Maven:
mvn clean install
Using Gradle:
./gradlew run
Example output:
#Using Maven
$ mvn clean install
[INFO] Scanning for projects...
[INFO] Building kepler-test 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
...
Hello World!
# Using Gradle
$ ./gradlew run
> Task :run
Hello World!
BUILD SUCCESSFUL in 3s
Last updated: Sep 30, 2025