|
| 1 | +--- |
| 2 | +id: appium-androidtv |
| 3 | +title: Android TV Automation |
| 4 | +sidebar_label: Android TV |
| 5 | +description: Learn how to automate Android TV apps using Appium with a step-by-step tutorial and sample Python code. |
| 6 | +keywords: |
| 7 | + - android tv |
| 8 | + - appium |
| 9 | + - automation |
| 10 | + - androidtv |
| 11 | + - nvidia shield |
| 12 | + - python |
| 13 | +url: https://www.lambdatest.com/support/docs/appium-androidtv |
| 14 | +site_name: LambdaTest Docs |
| 15 | +slug: appium-androidtv |
| 16 | + |
| 17 | +--- |
| 18 | + |
| 19 | +import CodeBlock from '@theme/CodeBlock'; |
| 20 | +import {YOUR_LAMBDATEST_USERNAME, YOUR_LAMBDATEST_ACCESS_KEY} from "@site/src/component/keys"; |
| 21 | + |
| 22 | +import Tabs from '@theme/Tabs'; |
| 23 | +import TabItem from '@theme/TabItem'; |
| 24 | + |
| 25 | +<script type="application/ld+json" |
| 26 | + dangerouslySetInnerHTML={{ __html: JSON.stringify({ |
| 27 | + "@context": "https://schema.org", |
| 28 | + "@type": "BreadcrumbList", |
| 29 | + "itemListElement": [{ |
| 30 | + "@type": "ListItem", |
| 31 | + "position": 1, |
| 32 | + "name": "Home", |
| 33 | + "item": "https://www.lambdatest.com" |
| 34 | + },{ |
| 35 | + "@type": "ListItem", |
| 36 | + "position": 2, |
| 37 | + "name": "Support", |
| 38 | + "item": "https://www.lambdatest.com/support/docs/" |
| 39 | + },{ |
| 40 | + "@type": "ListItem", |
| 41 | + "position": 3, |
| 42 | + "name": "Apple TV With Appium", |
| 43 | + "item": "https://www.lambdatest.com/support/docs/appium-appletv/" |
| 44 | + }] |
| 45 | + }) |
| 46 | + }} |
| 47 | +></script> |
| 48 | +## Tutorial To Run Your First Test On LambdaTest |
| 49 | +--- |
| 50 | +As smart TVs continue to grow in popularity, relying solely on manual testing is no longer sufficient. Automating Android TV testing provides broader device coverage, enhances user experience by validating remote-based navigation and voice commands, and eliminates repetitive manual tasks. It also helps uncover issues earlier in the development cycle, ensuring a smooth and consistent experience across different Android TV models. |
| 51 | +In this guide, you will learn how to set up and run your **Android TV** automation testing scripts with **Appium** on the **LambdaTest Real Device Cloud platform**. |
| 52 | + |
| 53 | +> To enable it for your organization, please contact us via <span className="doc__lt" onClick={() => window.openLTChatWidget()}>**24×7 chat support**</span> or you can also drop a mail to **[email protected]**.<br /> |
| 54 | +
|
| 55 | +## Objective |
| 56 | +--- |
| 57 | +By the end of this topic, you will be able to: |
| 58 | + |
| 59 | +1. Set up an environment for testing your Apps using **Android TV** with **Appium**. |
| 60 | +2. Understand and configure the core capabilities required for your Appium test suite. |
| 61 | +3. Explore the advanced features of LambdaTest. |
| 62 | + |
| 63 | +## Prerequisites |
| 64 | + |
| 65 | +--- |
| 66 | + |
| 67 | +Before you can start performing App automation testing with Appium, you would need to follow these steps: |
| 68 | + |
| 69 | +- You have access to LambdaTest username and accessKey. If you have not registered yet, you can do the same by visiting our [website](https://accounts.lambdatest.com/register). You will be able to access the credentials in the [LambdaTest Profile](https://accounts.lambdatest.com/detail/profile) |
| 70 | +- Install the latest Python build from the [official website](https://www.python.org/downloads/). We recommend using the latest version. |
| 71 | +- Make sure **pip** is installed in your system. You can install **pip** from [pip documentation](https://pip.pypa.io/en/stable/installation/). |
| 72 | + |
| 73 | +--- |
| 74 | +## Supported Models |
| 75 | + |
| 76 | +| Device Model | Platform Version | |
| 77 | +|----------------------|------------------| |
| 78 | +| Nvidia Shield TV | Android 11 | |
| 79 | + |
| 80 | +## Run Your First Test |
| 81 | +--- |
| 82 | +### 1. Upload your application |
| 83 | +Upload your **Android TV** application (.ipa file) to the LambdaTest servers using our **REST API**. You need to provide your **Username** and **AccessKey** in the format `Username:AccessKey` in the **cURL** command for authentication. Make sure to add the path of the **appFile** in the cURL request. Here is an example cURL request to upload your app using our REST API: |
| 84 | + |
| 85 | + **Using App File from System:** |
| 86 | + <div className="lambdatest__codeblock"> |
| 87 | +<CodeBlock className="language-bash"> |
| 88 | +{`curl -u "undefined:undefined" -X POST "https://manual-api.lambdatest.com/app/upload/realDevice" -F "appFile=@"/Users/macuser/Downloads/android-tv-sample-app.apk"" -F "name="androidtv_app" -F "type="androidtv"" |
| 89 | +`} |
| 90 | +</CodeBlock> |
| 91 | +</div> |
| 92 | + |
| 93 | + |
| 94 | +### 2. Set Up Authentication |
| 95 | + |
| 96 | +Make sure you have your LambdaTest credentials with you to run test automation scripts on LambdaTest. To obtain your access credentials, [purchase a plan](https://billing.lambdatest.com/billing/plans) or access the [Automation Dashboard](https://appautomation.lambdatest.com/). Then, set LambdaTest `Username` and `Access Key` in environment variables with following commands. |
| 97 | + |
| 98 | +<Tabs className="docs__val"> |
| 99 | + |
| 100 | +<TabItem value="bash" label="Linux / MacOS" default> |
| 101 | + <div className="lambdatest__codeblock"> |
| 102 | + <CodeBlock className="language-bash"> |
| 103 | + {`export LT_USERNAME=${ YOUR_LAMBDATEST_USERNAME()} \\ |
| 104 | +export LT_ACCESS_KEY=${ YOUR_LAMBDATEST_ACCESS_KEY()}`} |
| 105 | +</CodeBlock> |
| 106 | +</div> |
| 107 | + |
| 108 | +</TabItem> |
| 109 | + |
| 110 | +<TabItem value="powershell" label="Windows" default> |
| 111 | + |
| 112 | + <div className="lambdatest__codeblock"> |
| 113 | + <CodeBlock className="language-powershell"> |
| 114 | + {`set LT_USERNAME=${ YOUR_LAMBDATEST_USERNAME()} \` |
| 115 | +set LT_ACCESS_KEY=${ YOUR_LAMBDATEST_ACCESS_KEY()}`} |
| 116 | +</CodeBlock> |
| 117 | +</div> |
| 118 | + |
| 119 | +</TabItem> |
| 120 | +</Tabs> |
| 121 | + |
| 122 | +### 3. Configure Desired Capabilities |
| 123 | + |
| 124 | +In your automation script, set up the **platform capability** to specify that you are testing on an Android TV device. |
| 125 | + |
| 126 | +<Tabs> |
| 127 | +<TabItem value="Python" label="Python" default> |
| 128 | + |
| 129 | +```python |
| 130 | + desired_caps = { |
| 131 | + "deviceName" : "Nvidia Shield TV", |
| 132 | + "platformVersion" : "11", |
| 133 | + #highlight-next-line |
| 134 | + "platform" : "androidtv", |
| 135 | + "isRealMobile":True, |
| 136 | + "build": "Android TV Testing", |
| 137 | + "app":"APP_URL", # Enter app url here |
| 138 | + "network": False, |
| 139 | + "geoLocation": "FR", |
| 140 | + "devicelog": True, |
| 141 | + "privateCloud": True, # For private cloud testing |
| 142 | + "visual" : True, |
| 143 | + "autoGrantPermissions": True |
| 144 | + |
| 145 | + } |
| 146 | +``` |
| 147 | + |
| 148 | +</TabItem> |
| 149 | +</Tabs> |
| 150 | + |
| 151 | +## Additional Links |
| 152 | + |
| 153 | +--- |
| 154 | + |
| 155 | +- [Advanced Configuration for Capabilities](https://www.lambdatest.com/support/docs/desired-capabilities-in-appium/) |
| 156 | +- [How to test locally hosted apps](https://www.lambdatest.com/support/docs/testing-locally-hosted-pages/) |
| 157 | +- [How to integrate LambdaTest with CI/CD](https://www.lambdatest.com/support/docs/integrations-with-ci-cd-tools/) |
| 158 | + |
| 159 | +<nav aria-label="breadcrumbs"> |
| 160 | + <ul className="breadcrumbs"> |
| 161 | + <li className="breadcrumbs__item"> |
| 162 | + <a className="breadcrumbs__link" target="_self" href="https://www.lambdatest.com"> |
| 163 | + Home |
| 164 | + </a> |
| 165 | + </li> |
| 166 | + <li className="breadcrumbs__item"> |
| 167 | + <a className="breadcrumbs__link" target="_self" href="https://www.lambdatest.com/support/docs/"> |
| 168 | + Support |
| 169 | + </a> |
| 170 | + </li> |
| 171 | + <li className="breadcrumbs__item breadcrumbs__item--active"> |
| 172 | + <span className="breadcrumbs__link"> |
| 173 | + Roku TV With Appium |
| 174 | +</span> |
| 175 | + </li> |
| 176 | + </ul> |
| 177 | +</nav> |
| 178 | + |
| 179 | + |
| 180 | + |
0 commit comments