Use Remote Control Navigation
Since Fire TV devices don’t have a touch screen and user interaction happens via a remote control, remote control navigation becomes a primary feature for Fire TV apps. Also, not all elements in the app have unique identifiers and those elements can be accessed via remote control navigation only. For Appium based tests, Android keycodes can be used to control Amazon Fire TV Stick remote buttons. We can call the pressKey method (with the relevant keycode) to press any remote control button.
Example:
driver.pressKey(new KeyEvent(AndroidKey.DPAD_DOWN)); //Press DPAD_DOWN
driver.pressKey(new KeyEvent(AndroidKey.DPAD_RIGHT)); //Press DPAD_RIGHT
driver.pressKeycode(20); //Press DPAD_DOWN
driver.pressKeycode(22); //Press DPAD_RIGHT
driver.press_keycode(20) # DPAD_DOWN
driver.press_keycode(22) # DPAD_RIGHT
Here is a complete list of Fire TV Remote buttons mapping:
KeyCode | Button | KeyEvent | Behaviour |
---|---|---|---|
4 | Back | KEYCODE_BACK | Return the user to the previous operation or screen (Activity). |
82 | Menu | KEYCODE_MENU | Invoke the Android context menu (OptionsMenu) |
23 | Select (D-Pad Center) | KEYCODE_DPAD_CENTER | Select the user interface item with the current focus. |
19 | Up (D-Pad) | KEYCODE_DPAD_UP | Move the focus upward in the user interface. |
20 | Down (D-Pad) | KEYCODE_DPAD_DOWN | Move the focus downward in the user interface. |
21 | Left (D-Pad) | KEYCODE_DPAD_LEFT | Move the focus left in the user interface. |
22 | Right (D-Pad) | KEYCODE_DPAD_RIGHT | Move the focus right in the user interface. |
85 | Play/Pause | KEYCODE_MEDIA_PLAY_PAUSE | Control media playback. Play/Pause is a toggle. |
89 | Rewind | KEYCODE_MEDIA_REWIND | Rewind or skip backwards in media playback contexts. |
90 | Fast Forward | KEYCODE_MEDIA_FAST_FORWARD | Fast Forward or skip ahead in media playback contexts. |
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!