Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

dump.py: Added -F|--force-view-server-use options

- Sometimes, even if UiAutomator is available you want to stick to
ViewServer (perhaps to get the View id's), this option enables it
  • Loading branch information...
commit 5343b8eb20f9555d5fbb24542cca28f906d08960 1 parent 5450c6e
@dtmilano authored
Showing with 11 additions and 7 deletions.
  1. +11 −7 AndroidViewClient/examples/dump.py
View
18 AndroidViewClient/examples/dump.py
@@ -29,6 +29,7 @@
from com.dtmilano.android.viewclient import ViewClient
VERBOSE = 'verbose'
+FORCE_VIEW_SERVER_USE = 'force-view-server-use'
UNIQUE_ID = 'uniqueId'
POSITION = 'position'
CONTENT_DESCRIPTION = 'content-description'
@@ -40,24 +41,27 @@
}
def usage():
- print >> sys.stderr, 'usage: dump.py [-V|--%s] [-u|--%s] [-x|--%s] [-d|--%s] [-c|--%s] [serialno]' % \
- (VERBOSE, UNIQUE_ID, POSITION, CONTENT_DESCRIPTION, CENTER)
+ print >> sys.stderr, 'usage: dump.py [-V|--%s] [-F|--%s] [-u|--%s] [-x|--%s] [-d|--%s] [-c|--%s] [serialno]' % \
+ (VERBOSE, FORCE_VIEW_SERVER_USE, UNIQUE_ID, POSITION, CONTENT_DESCRIPTION, CENTER)
sys.exit(1)
try:
- opts, args = getopt.getopt(sys.argv[1:], 'Vuxdc',
- [VERBOSE, UNIQUE_ID, POSITION, CONTENT_DESCRIPTION, CENTER])
+ opts, args = getopt.getopt(sys.argv[1:], 'VFuxdc',
+ [VERBOSE, FORCE_VIEW_SERVER_USE, UNIQUE_ID, POSITION, CONTENT_DESCRIPTION, CENTER])
except getopt.GetoptError, e:
print >>sys.stderr, 'ERROR:', str(e)
usage()
verbose = False
+kwargs = {'forceviewserveruse': False}
transform = ViewClient.TRAVERSE_CIT
for o, a in opts:
o = o.strip('-')
if o in ['V', VERBOSE]:
verbose = True
- continue
- transform = MAP[o]
+ elif o in ['F', FORCE_VIEW_SERVER_USE]:
+ kwargs['forceviewserveruse'] = True
+ else:
+ transform = MAP[o]
-ViewClient(*ViewClient.connectToDeviceOrExit(verbose=verbose)).traverse(transform=transform)
+ViewClient(*ViewClient.connectToDeviceOrExit(verbose=verbose), **kwargs).traverse(transform=transform)
Please sign in to comment.
Something went wrong with that request. Please try again.