Skip to main content

App Automation Using Emulators and Simulators on LambdaTest

In this documеntation, learn how to run app automated tests on Emulators and Simulators using LambdaTest virtual testing cloud.


Currently, App Automation is available for Emulators and Simulators in the Beta phase, with support for the Appium framework. To use this feature, Contact Sales.


Bеforе you gеt startеd with App Automation on LambdaTеst, makе surе you havе thе following prеrеquisitеs in placе:

  1. Sign up for a LambdaTеst account if you havеn't alrеady.

  2. Install Appium Java Client.

  3. A LambdaTest Username and Access Key.

  4. Ensure you have an access to an Android app (.apk or .aab file) or an iOS zip file (containing .app file).


Don't have .apk or .app filеs? You can still run your samplе tеsts on LambdaTеst using our samplе Android and iOS applications, accеssiblе through thе following links:

Run Your First Test

Here are the following steps to run your first app automated test on Emulators and Simulators.

Step 1: Upload Your Application

Upload your iOS application (.app file) or Android application (.apk 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:

curl -u "<USERNAME>:<KEY>" --location --request POST '' --form 'name="Android_App"' --form 'appFile=@"/Users/macuser/Downloads/proverbial_android.apk"'  

Response of above cURL will be a JSON object containing the App URL of the format - lt://APP123456789123456789 and will be used in the Step 2.

Step 2: Write Your Automation Script

  1. Write your automation script in your preferred language that Appium framework supports.

Here is a sample automation script in Java for the sample app downloaded above. You can clone the automation code in Java for the sample app from the LambdaTest GitHub repository.

In the below test script, ensure to update the app_url, username and accesskey.

Set the Capability

To run the test on Emulator/Simulator, set the isRealMobile capability to false.

# Tested on python3, Selenium 4.9.0, Appium-Python-Client 2.2.0

from appium import webdriver
from import By
import time

def startingTest():
print(f"Starting test")
desiredCap = caps[0].copy()

f"deviceName {desiredCap['lt:options'].get('deviceName')}, platformVersion {desiredCap['lt:options'].get('platformVersion')}"

driver = webdriver.Remote(command_executor=url, desired_capabilities=desiredCap)
except Exception as e:
print("err", e)

print(f"driver created")

ctx = driver.current_context
print("ctx", ctx)
sessionId = driver.session_id
print("sessionId", sessionId)
isKeyBoardShown = driver.is_keyboard_shown()
print(f"isKeyboardShown {isKeyBoardShown}")
isLocked = driver.is_locked()
print("isLocked", isLocked)
isInstalled = driver.is_app_installed("com.example.QAapp")
print("isInstalled", isInstalled)

elem = driver.find_element(By.ID, "com.example.QAapp:id/webpage").click()
print("element", elem)

driver.find_element(By.ID, "com.example.QAapp:id/websiteName").send_keys(
driver.find_element(By.ID, "websiteName").clear()
elem = driver.find_element(By.ID, "com.example.QAapp:id/findButton")
print("element", elem)

driver.find_element(By.ID, "com.example.QAapp:id/websiteName").click()
params = {"command": "input-text", "text": "thisIsMyText"}
result = driver.execute_script("lambda-adb", params)
print("result", result)

driver.find_element(By.ID, "com.example.QAapp:id/websiteName").send_keys(
driver.find_element(By.ID, "findButton").click()
driver.find_element(By.ID, "com.example.QAapp:id/websiteName").send_keys(
driver.find_element(By.ID, "findButton").click()

if desiredCap["lt:options"].get("tunnel"):
driver.find_element(By.ID, "com.example.QAapp:id/websiteName").send_keys(
driver.find_element(By.ID, "findButton").click()

driver.orientation = "LANDSCAPE"

print("Quitting test")
except Exception as e:

url = "https://{USERNAME}:{ACCESS_KEY}"

buildName = "Testing build"
numTests = 1

caps = [
"lt:options": {
"w3c": True,
"platformName": "Android",
"allowInvisibleElements": True,
"deviceName": "Galaxy A33 5G",
"platformVersion": "13",
"app": "YOUR_APP_URL",
"devicelog": True,
"build": buildName,
"visual": True,
"network": True,
"tunnel": False,
"video": True,
"isRealMobile": false,
  1. Create .XML file in order to run your test and define device capabilities. Please find sample code below for the same.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "">
<suite thread-count="100" name="Mobile" parallel="tests">

<test name="AppTest 1">
<parameter name="version" value="11"/>
<parameter name="platform" value="Android"/>
<parameter name="device" value="Galaxy S21 Ultra 5G"/>
<class name="AndroidApp"/>

<test name="AppTest 2">
<parameter name="version" value="11"/>
<parameter name="platform" value="Android"/>
<parameter name="device" value="Galaxy S21"/>
<class name="AndroidApp"/>

Step 3: Execute Your Test Case

Debug and run your code. Run or in your editor.

Step 4: View Test Execution

Once you have run your tests, you can view the test execution along with logs. You will be able to see the test cases passing or failing. You can view the same at LambdaTest App Automation Dashboard.

More About Desired Capabilities

Sample Capabilities for both Android and iOS are mentioned below -

"deviceName": "Galaxy Tab S4",
"platformName": "android",
"platformVersion": "10",
"app": "App_url",
"visual": true,
"console": true,
"deviceOrientation": "PORTRAIT",
"build": "new-12",
"isRealMobile": false,

Test across 3000+ combinations of browsers, real devices & OS.

Book Demo

Help and Support

Related Articles