as

Settings
Sign out
Notifications
Alexa
Amazonアプリストア
AWS
ドキュメント
Support
Contact Us
My Cases
開発
設計と開発
公開
リファレンス
サポート
アクセスいただきありがとうございます。こちらのページは現在英語のみのご用意となっております。順次日本語化を進めてまいりますので、ご理解のほどよろしくお願いいたします。

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

  1. Complete the steps in Set Up Testing with Appium.
  2. Review Manage Appium Sessions for capabilities configuration.
  3. Confirm if the Appium server is running on default port 4723:

    Copied to clipboard.

     curl http://localhost:4723/status
    
  4. Have a Vega-supported Fire TV device or Vega Virtual Device with a target app installed.

Write your test script

  1. Choose your preferred integrated development environment and programming language.
  2. Create a new file with the following code snippet:

    Python:

    Copied to clipboard.

     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:

    Copied to clipboard.

         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

    1. Check for Maven installation.

      Copied to clipboard.

       mvn --version
      
    2. Create a pom.xml in your project root.

      Copied to clipboard.

       <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>
      
    3. Create a test class. See text class.

    Project setup using Gradle

    1. Verify Gradle installation:

      Copied to clipboard.

       gradle --version
      
    2. Create build.gradle in your project root:

      Copied to clipboard.

      
       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'
       }
      
    3. Create settings.gradle.

      Copied to clipboard.

       rootProject.name = 'kepler-test'
      
    4. Create a test class. See text class.

Test class

Copied to clipboard.

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.

  1. Open a command prompt.
  2. Navigate to your test file location.
  3. Run the test.

Python:

Copied to clipboard.

python test.py

Example output:

$ python test.py
Execute script command run was successful:
Hello World!

JavaScript:

Copied to clipboard.

node test.js

Example output:

$ node test.js
{
  x: 150,
  y: 200,
  width: 300,
  height: 400
}

Java

Using Maven:

Copied to clipboard.

mvn clean install

Using Gradle:

Copied to clipboard.

./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