Skip to content

enhancement for the python implement of android uiautomator. provide image comparision

Notifications You must be signed in to change notification settings

hongbinbao/uiautomatorplug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

uiautomatorplug

enhancement for the python implement of android uiautomator JSON RPC client. and provide image comparision feature.

Installation

 sudo pip install uiautomatorplug

Dependency

1: sudo pip install uiautomator (https://github.com/xiaocong/uiautomator/blob/master/uiautomator.py).
2: sudo apt-get install python-opencv
3: sudo apt-get install python-numpy
4: target android device: sdk_version>=16

API of uiautomatorplug

1: support all API defined in origin uiautomator python binding (https://github.com/xiaocong/uiautomator/blob/master/uiautomator.py)
2: expect('x.png'), find('x.png'), click('x.png')

Usage

>>> from uiautomatorplug.android import device as d
>>> d.set_internal_storage_dir('/storage/sdcard1/') ###default screenshot saving path is '/sdcard/' on device
>>> d.info
>>> d.orientation
>>> d.orientation = 'l'
>>> d.wakeup()
>>> d.start_activity(action='android.intent.action.DIAL', data='tel:xxxx', flags=0x04000000)
>>> d.find('path/phone_launch_success.png')
>>> d.click(100, 200)
>>> d.click('path/DPAD_NUMBER_1.png')
>>> d.click('path/DPAD_NUMBER_1.png', rotation=90)
>>> d.exists(text='string_value_of_screen_layout_component_text_attribute')
>>> d.expect('path/phone_launch_success.png')
>>> d(text='Settings').click()

device configuration

the screenshot of android device will be captured into device's '/sdcard/' folder as default.
to change the screenshot saving path on device to be your device real storage path:

from uiautomatorplug.android import device as d
d.set_internal_storage_dir('/storage/sdcard1/')

About

enhancement for the python implement of android uiautomator. provide image comparision

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages