Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

adb_tools

Generic setup for scripting an Android device via ADB.

Project structure

adb_tools/
├── platform-tools/
│   └── adb.exe              # ADB executable
├── helper/
│   ├── find_coords.py       # Click on the screen to get coordinates + RGB
│   └── make_a_screen.py     # Capture a region of the screen in PNG
├── tools/
│   ├── __init__.py
│   └── adb.py               # All ADB functions
├── check_id.py              # List all connected devices
├── config.json              # Device ID of the target device
└── README.md

How to install

  1. Install dependencies:
pip install pillow matplotlib
  1. Fill the device_id in config.json (use check_id.py to find it)

How to use

from tools import tap, swipe, write, compare_image, is_color, stop, path

tap(500, 300)
hold(500, 300, ms=800) # Hold right button for 800ms
swipe(100, 800, 100, 200)
write("hello world")
enter() # Enter key
delete() # Delete key

# Image - relative path to the project root
if not compare_image(path("img/example.png"), (0, 0, 200, 100)):
    stop("Example image not found")

# Color
if is_color(540, 960, (255, 0, 0)):
    tap(540, 960)

Helpers

Script Usage
check_id.py Display all connected ADB devices
helper/find_coords.py Capture the screen, click to get coordinates + RGB
helper/make_a_screen.py Capture a defined region and save it in PNG

About

Generic setup for scripting an Android device via ADB.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages