How to Set Up Appium for Android Mobile Automation with Python

This step‑by‑step guide shows how to install the Android SDK, configure Java JDK, install Appium, and write Python code to automate the WeChat app on Android devices, including common pitfalls and practical solutions.

Python Crawling & Data Mining
Python Crawling & Data Mining
Python Crawling & Data Mining
How to Set Up Appium for Android Mobile Automation with Python

1. Introduction

Recently I was working on mobile app automation using Appium and needed to configure the environment. Existing tutorials were outdated, so I recorded the steps I took to install Appium correctly.

2. Step 1 – Install Android SDK

Download the Android SDK from androiddevtools.cn .

The download proceeds smoothly. When launching SDK Manager.exe nothing happens, so I searched for solutions. The first workaround was to install Android Studio, which includes the SDK, but it raised an error after installation. To open Android Studio, edit bin\idea.properties in the installation directory and add disable.android.first.run=true . This only bypasses the first‑run check and does not solve the SDK installation problem. The second workaround is to modify the hosts file ( C:\Windows\System32\drivers\etc\hosts ) to resolve the SDK download domain. After adding the two lines shown and restarting Android Studio, the required Android platform can be installed successfully.

3. Step 2 – Install Java JDK

Download JDK 13.0.1 from Oracle . Set the following system environment variables:

JAVA_HOME = C:\Program Files\Java\jdk-13.0.1

CLASSPATH = %java_home%\lib

Note that older tutorials suggest a different CLASSPATH value; newer JDK versions no longer contain dt.jar and tools.jar , so adjust accordingly.

4. Step 3 – Install Appium

Download Appium from the official website and install it. Start the server (v1.8.1). Configure the session capabilities: platformName (device OS), deviceName (model), appPackage and appActivity (e.g., WeChat). Click “Start Session” to launch the app on the device.

5. Step 4 – Write Test Code

Sample test code is shown in the screenshot. Running this code opens the WeChat login screen, after which Appium can interact with UI elements just like Selenium does with web pages. Use the Appium inspector to locate element identifiers.

6. Conclusion

This guide demonstrates how to set up the Android SDK, Java JDK, and Appium for Python‑based mobile automation testing, and provides a basic code example for controlling the WeChat app.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

PythonAndroidtestingAppiumMobile AutomationAppium Setup
Python Crawling & Data Mining
Written by

Python Crawling & Data Mining

Life's short, I code in Python. This channel shares Python web crawling, data mining, analysis, processing, visualization, automated testing, DevOps, big data, AI, cloud computing, machine learning tools, resources, news, technical articles, tutorial videos and learning materials. Join us!

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.