Skip to content

Latest commit

 

History

History
42 lines (30 loc) · 1.26 KB

README.md

File metadata and controls

42 lines (30 loc) · 1.26 KB

Why you need it ?

Maybe you need todo testing or automation on you android device by you pc by pure-python android developer bridge.

Connecting

  1. Give all acceses on your phone for usb debugging.(Once)
  2. Download ppadb on your pc, and run adb server(you need just Adroid Studio running)
  3. Connect phone to pc by usb cable.
  4. Run script on Python See result

Commands (basic)

from ppadb.client import Client

# Connecting
device = Client(host='127.0.0.1', port=5037).devices()[0]

# Tap
x, y = 15, 15
device.shell(f'input tap {x} {y}')

package_name = "com.google.android.youtube" # Youtube

# Opening, closing app. You need a package nape of app
device.shell('monkey -p {} -c android.intent.category.LAUNCHER 1'.format(package_name)) 
device.shell('am force-stop {}'.format(package_name))

#  Swipe
x0, y0, x1, y1 = 100, 200, 100, 500
device.shell(f'input swipe {x0} {y0} {x1} {y1}') 

Other commands

About library, More simple

How works x, y

You can use screenshot and finding in it point in pixels, in photo editor.

Cordinates