Control Your Android Phone from the Terminal with PhoneDriver
Ever found yourself in a loop of picking up your Android phone to test an app, putting it down, typing a command, and picking it up again? Or wished you could script a series of UI actions for automated testing without a heavyweight cloud service? There's a new tool that cuts out the middleman and gives you direct control right from your command line.
PhoneDriver is an open-source project that lets you send commands to an Android device over ADB to simulate touches, swipes, text input, and more. It turns your terminal into a remote control for your phone's screen. It's the kind of simple, direct utility that feels like it should have existed all along.
What It Does
In essence, PhoneDriver is a Python-based CLI tool. It communicates with your Android device using the standard Android Debug Bridge (ADB). You issue commands like click, swipe, or text from your terminal, and PhoneDriver translates them into the appropriate ADB shell input commands. It can also fetch screenshots directly to your computer, making it possible to integrate visual feedback into scripts.
Why It's Cool
The beauty of PhoneDriver is in its simplicity and local-first approach. Unlike some automated testing frameworks, there's no need for a complex setup, an extra app on the phone, or a cloud infrastructure. It leverages the tools most Android developers already have installed—Python and ADB.
This opens up some neat use cases:
- Quick Automation: Write a shell script to navigate your phone, post a repetitive social media update, or batch-install apps.
- Developer Testing: Automate a specific user flow on your own app during development without leaving your IDE.
- Accessibility Helper: Could be repurposed to script sequences that assist with repetitive touch tasks.
- Just for Fun: Impress your friends by controlling your phone seemingly by magic from your laptop.
It's a focused tool that does one job well, which is always a win in a developer's toolkit.
How to Try It
Getting started is straightforward. You'll need Python and ADB set up and your Android device connected and authorized for debugging.
Clone the repo:
git clone https://github.com/OminousIndustries/PhoneDriver cd PhoneDriverInstall the required Python package:
pip install pillowRun the script with