Example #1
0
#!/usr/bin/env python
#! /usr/bin/env shebang monkeyrunner -plugin $ANDROID_VIEW_CLIENT_HOME/bin/androidviewclient-$ANDROID_VIEW_CLIENT_VERSION.jar @!
#
# Linux:
#! /usr/local/bin/shebang monkeyrunner -plugin $AVC_HOME/bin/androidviewclient-$AVC_VERSION.jar @!
#
# Other:
#! /path/to/monkeyrunner -plugin /path/to/androidviewclient/bin/androidviewclient-2.3.14.jar
#
# No shebang:
# c:>path\to\monkeyrunner -plugin \path\to\androidviewclient-2.3.13.jar dump-all-windows-lib.py
'''
Copyright (C) 2012  Diego Torres Milano
Created on Apr 30, 2013
@author: diego
'''
from androidviewclient3.viewclient import ViewClient
kwargs2 = {'autodump': False, 'forceviewserveruse': True}
vc = ViewClient(*ViewClient.connectToDeviceOrExit(), **kwargs2)
windows = vc.list()
for wId in windows.keys():
    print(">>> window=", wId, windows[wId])
    vc.dump(window=wId)
    vc.traverse(transform=ViewClient.TRAVERSE_CIT, indent="    ")

Example #2
0
#! /usr/bin/env python
'''
Copyright (C) 2014  Diego Torres Milano
Created on Apr 24, 2014
@author: diego
'''
import sys
import os
try:
    sys.path.insert(0, os.path.join(os.environ['ANDROID_VIEW_CLIENT_HOME'], 'src'))
except:
    pass
from androidviewclient3.viewclient import ViewClient
kwargs1 = {'verbose': True, 'ignoresecuredevice': True}
kwargs2 = {'startviewserver': True, 'forceviewserveruse': True, 'autodump': False, 'ignoreuiautomatorkilled': True}
vc = ViewClient(*ViewClient.connectToDeviceOrExit(**kwargs1), **kwargs2)
windows = vc.list()
for wId in windows.keys():
    print(">>> window=", wId, windows[wId])
    vc.dump(window=wId)
    vc.traverse(transform=ViewClient.TRAVERSE_CITCD, indent="    ")