#!/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=" ")
#! /usr/bin/env python2.7
#! /usr/bin/env python ''' Copyright (C) 2012 Diego Torres Milano Created on Sep 8, 2012 @author: diego @see: http://code.google.com/p/android/issues/detail?id=36544 ''' import re import sys import os # This must be imported before MonkeyRunner and MonkeyDevice, # otherwise the import fails. # PyDev sets PYTHONPATH, use it try: for p in os.environ['PYTHONPATH'].split(':'): if not p in sys.path: sys.path.append(p) except: pass try: sys.path.append(os.path.join(os.environ['ANDROID_VIEW_CLIENT_HOME'], 'src')) except: pass from androidviewclient3.viewclient import ViewClient, View device, serialno = ViewClient.connectToDeviceOrExit() DEBUG = True FLAG_ACTIVITY_NEW_TASK = 0x10000000 # We are not using Settings as the bug describes because there's no WiFi dialog in emulator componentName = 'com.android.settings/.Settings'
#! /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=" ")