Back to blog
    November 22, 2026Tutorial

    Testing Apple TV and Android TV Apps with Appium: The Remote Is the Only Difference

    Short answer: point your phone suite at a TV and every tap() does nothing, but almost everything else already works. Apple TV runs on Appium's XCUITest driver with platformName: tvOS, and Android TV, Google TV and Chromecast run on UiAutomator2, the same driver as an Android phone. Locators, page source, screenshots and assertions all carry over. Input doesn't: a TV has no touchscreen, so tap(), scroll() and fill() stop being useful and every action becomes a remote button press. This post covers the capabilities, the button commands on each platform, how to navigate a focus-driven UI reliably, and how to write one test that runs on both.

    What changes from a phone, and what doesn't

    PhoneApple TVAndroid TV / Google TV
    Appium driverXCUITest / UiAutomator2XCUITestUiAutomator2
    platformNameiOS / AndroidtvOSAndroid
    Find elementsLocatorsSame locatorsSame locators
    Act on an elementTap itMove the focus to it, press SelectMove the focus to it, press DPAD_CENTER
    ScrollSwipePress a direction until the target is focusedSame
    BackBack gesture or buttonMenu buttonBACK key

    If you already have page objects for the phone app, keep them. What you replace is the layer that turns "open Settings" into gestures.

    Pressing buttons

    The two platforms send keys through completely different commands.

    Apple TV uses the XCUITest driver's mobile: pressButton with a button name: up, down, left, right, select, menu, home and playpause.

    js
    // Apple TV: XCUITest with platformName tvOS
    const tv = await remote({ ...grid, capabilities: {
      platformName: 'tvOS',
      'appium:automationName': 'XCUITest',
      'appium:bundleId': 'com.example.tvapp',
    }});
    
    await tv.execute('mobile: pressButton', { name: 'down' });
    await tv.execute('mobile: pressButton', { name: 'select' });
    await tv.execute('mobile: pressButton', { name: 'menu' }); // back one level

    Android TV has no button-name command. You send Android KEYCODE_* values with pressKeyCode:

    ButtonKeycode
    Up / Down / Left / Right19 / 20 / 21 / 22
    Select (DPAD_CENTER)23
    Back4
    Home3
    Play/Pause85
    js
    // Android TV, Google TV, Chromecast: UiAutomator2, same as a phone
    const tv = await remote({ ...grid, capabilities: {
      platformName: 'Android',
      'appium:automationName': 'UiAutomator2',
      'appium:app': '/path/to/tv-app.apk',
    }});
    
    await tv.pressKeyCode(20); // DPAD_DOWN
    await tv.pressKeyCode(23); // DPAD_CENTER
    await tv.pressKeyCode(4);  // BACK

    Navigating a focus-driven UI

    On a phone you find the element and tap it. On a TV you can find the element, but you cannot tap it. You have to move the focus ring onto it, one press at a time, and then press Select. This is where most first TV suites go wrong, in three ways.

    1. Pressing a fixed number of times. "Down, down, down, select" breaks the day a row is added to the menu. Walk the focus until a condition holds instead, and cap the attempts so a missing item fails the test rather than looping forever:

    js
    async function focusTo(press, isThere, { direction = 'down', attempts = 12 } = {}) {
      for (let i = 0; i < attempts; i++) {
        if (await isThere()) return true;
        await press(direction);
      }
      return isThere();
    }

    This is the TV version of the scroll-until-visible loop you already write for long lists on a phone.

    2. Checking the wrong thing. "The Settings button exists" is true from the first screen onwards. You want "Settings has the focus". On Android TV the page source marks the focused element with focused="true", so the check is a locator such as //*[@focused='true' and @text='Settings']. On Apple TV, the simplest reliable check is the outcome: press Select and assert that the screen you expected opened, rather than trying to read the focus first.

    3. Pressing faster than the UI moves. TV interfaces animate focus changes. A burst of presses can arrive before the previous move finished, and the focus lands somewhere you didn't expect. Check after each press (the loop above does), and don't add fixed sleeps to compensate; a wait on the condition is both faster and more reliable.

    One test file for both platforms

    Apple calls the back button Menu; Android calls it Back. If your tests use either vendor's word, they only run on one platform. Name buttons after the intent instead (up, down, select, back, home, playPause) and map them in one place:

    js
    const BUTTONS = {
      up:        { appleTv: 'up',        androidKeycode: 19 },
      down:      { appleTv: 'down',      androidKeycode: 20 },
      left:      { appleTv: 'left',      androidKeycode: 21 },
      right:     { appleTv: 'right',     androidKeycode: 22 },
      select:    { appleTv: 'select',    androidKeycode: 23 },
      back:      { appleTv: 'menu',      androidKeycode: 4 },
      home:      { appleTv: 'home',      androidKeycode: 3 },
      playPause: { appleTv: 'playpause', androidKeycode: 85 },
    };
    
    const press = async (driver, isAppleTv, button) => {
      const key = BUTTONS[button];
      if (isAppleTv) await driver.execute('mobile: pressButton', { name: key.appleTv });
      else await driver.pressKeyCode(key.androidKeycode);
    };

    Now a scenario like "press down until Settings is focused, select it, check the General section is visible" is one test that runs against both platforms. Our public automation templates include a complete version of this as a remote fixture for Appwright, with a TV feature file that runs on Apple TV and Android TV unchanged.

    What you need real hardware for

    Simulators and emulators are fine for layout and focus order. They fall short on what TV apps are usually about:

    • Protected playback. FairPlay Streaming doesn't play in Apple's simulators, and Android TV emulators lack the hardware-backed Widevine level that many services require for HD. If your app plays DRM content, the playback path only runs on a real box.
    • Real decoding and audio. Codec support, audio output and how long a stream takes to start depend on the hardware.
    • Real remotes. The Siri Remote's touch surface and an Android TV remote's key repeat behave differently from scripted presses. Automate with key presses, but check the feel at least once by hand.

    Common mistakes

    • Calling click() or tap() on a TV element. It may appear to work in some setups and do nothing in others. Move the focus and press Select.
    • Hard-coding the number of presses. Use a focus loop with a cap.
    • Assuming Home is safe between tests. On both platforms Home leaves your app. If a test needs to reset, relaunch the app instead.
    • Forgetting the back button differs in name. Use neutral names from the start; retrofitting them into a hundred tests is painful.

    Doing it on RobotActions

    RobotActions has real Apple TV and Google TV / Android TV boxes in our cloud, at the same plans and the same per-device price as a phone. For automation, the capabilities above work unchanged on the grid. To get any free Android TV box instead of a phone, add 'appium:deviceClass': 'TV' to the Android capabilities.

    For manual testing, a TV session opens in the browser with a full remote beside the live stream: d-pad, OK, back, home, play/pause, volume and typing, with the TV's audio streamed along with the picture, so playback and sound can be checked rather than guessed. AI agents can drive Apple TV and Android TV over MCP too, with the same remote buttons.

    Try it free · No credit card required

    Ready to test on real devices?

    Sign in with Google or GitHub and get real iOS and Android devices in your browser — free to try.

    👋 Hi! Need help? Chat with us!

    Chat with us

    Connecting…

    Before we start

    Share your details so we can follow up with you.