Permalink
Browse files

Handles "UiAutomator killed" problem found on some devices

- Version 2.3.24
- culebra: version 0.9.12: added -k option
- dump: version 0.9.12: added -k option
  • Loading branch information...
1 parent a1f4b49 commit 054433bc3546e8c131bec3dcecf564d5a3a589bc @dtmilano committed Jun 17, 2013
@@ -17,7 +17,7 @@
@author: Diego Torres Milano
'''
-__version__ = '2.3.23'
+__version__ = '2.3.24'
import sys
import subprocess
@@ -1763,6 +1763,8 @@ def dump(self, window=-1, sleep=1):
print >>sys.stderr
print >>sys.stderr, received
print >>sys.stderr
+ if self.ignoreUiAutomatorKilled:
+ received = re.sub('</hierarchy>Killed', '</hierarchy>', received, re.MULTILINE)
if re.search('\[: not found', received):
raise RuntimeError('''ERROR: Some emulator images (i.e. android 4.1.2 API 16 generic_x86) does not include the '[' command.
While UiAutomator back-end might be supported 'uiautomator' command fails.
@@ -22,7 +22,7 @@ ___________________/ /__/ /__/ /__/ /________________________________
'''
-__version__ = '0.9.11'
+__version__ = '0.9.12'
import re
import sys
@@ -56,6 +56,7 @@ VERBOSE = 'verbose'
IGNORE_SECURE_DEVICE = 'ignore-secure-device'
FORCE_VIEW_SERVER_USE = 'force-view-server-use'
DO_NOT_START_VIEW_SERVER = 'do-not-start-view-server'
+DO_NOT_IGNORE_UIAUTOMATOR_KILLED = 'do-not-ignore-uiautomator-killed'
FIND_VIEWS_BY_ID = 'find-views-by-id'
FIND_VIEWS_WITH_TEXT = 'find-views-with-text'
FIND_VIEWS_WITH_CONTENT_DESCRIPTION = 'find-views-with-content-description'
@@ -73,8 +74,9 @@ WINDOW = 'window'
USAGE = 'usage: %s [OPTION]... [serialno]'
# -u,-s,-p,-v eaten by monkeyrunner
-SHORT_OPTS = 'HVIFSw:i:t:d:rCUj:D:K:R:a:o:A'
+SHORT_OPTS = 'HVIFSkw:i:t:d:rCUj:D:K:R:a:o:A'
LONG_OPTS = [HELP, VERBOSE, IGNORE_SECURE_DEVICE, FORCE_VIEW_SERVER_USE, DO_NOT_START_VIEW_SERVER,
+ DO_NOT_IGNORE_UIAUTOMATOR_KILLED,
WINDOW + '=',
FIND_VIEWS_BY_ID + '=', FIND_VIEWS_WITH_TEXT + '=', FIND_VIEWS_WITH_CONTENT_DESCRIPTION + '=',
USE_REGEXPS, VERBOSE_COMMENTS, UNIT_TEST,
@@ -88,6 +90,7 @@ LONG_OPTS_ARG = {WINDOW: 'WINDOW',
OUTPUT: 'FILENAME'}
OPTS_HELP = {
'H': 'prints this help',
+ 'k': 'don\'t ignore UiAutomator killed',
'w': 'use WINDOW content (default: -1, all windows)',
'i': 'whether to use findViewById() in script',
't': 'whether to use findViewWithText() in script',
@@ -336,6 +339,8 @@ for o, a in optlist:
kwargs2['forceviewserveruse'] = True
elif o in ['S', DO_NOT_START_VIEW_SERVER]:
kwargs2['startviewserver'] = False
+ elif o in ['k', DO_NOT_IGNORE_UIAUTOMATOR_KILLED]:
+ kwargs2['ignoreuiautomatorkilled'] = False
elif o in ['w', WINDOW]:
options[WINDOW] = a
elif o in ['i', FIND_VIEWS_BY_ID]:
@@ -6,7 +6,7 @@ Created on Feb 3, 2012
@author: diego
'''
-__version__ = '0.9.11'
+__version__ = '0.9.12'
import sys
import os
@@ -34,6 +34,7 @@ VERBOSE = 'verbose'
IGNORE_SECURE_DEVICE = 'ignore-secure-device'
FORCE_VIEW_SERVER_USE = 'force-view-server-use'
DO_NOT_START_VIEW_SERVER = 'do-not-start-view-server'
+DO_NOT_IGNORE_UIAUTOMATOR_KILLED = 'do-not-ignore-uiautomator-killed'
WINDOW = 'window'
UNIQUE_ID = 'uniqueId'
POSITION = 'position'
@@ -48,17 +49,18 @@ MAP = {'i':ViewClient.TRAVERSE_CITUI, UNIQUE_ID:ViewClient.TRAVERSE_CITUI,
USAGE = 'usage: %s [OPTION]... [serialno]'
# -u,-s,-p,-v eaten by monkeyrunner
-SHORT_OPTS = 'HVIFSw:ixdc'
+SHORT_OPTS = 'HVIFSkw:ixdc'
LONG_OPTS = [HELP, VERBOSE, IGNORE_SECURE_DEVICE, FORCE_VIEW_SERVER_USE,
- DO_NOT_START_VIEW_SERVER, WINDOW + '=',
+ DO_NOT_START_VIEW_SERVER, DO_NOT_IGNORE_UIAUTOMATOR_KILLED, WINDOW + '=',
UNIQUE_ID, POSITION, CONTENT_DESCRIPTION, CENTER]
LONG_OPTS_ARG = {WINDOW: 'WINDOW'}
OPTS_HELP = {
'H': 'prints this help',
'V': 'verbose comments',
'I': 'ignore secure device',
'F': 'force view server use (even if UiAutomator present)',
- 'S': 'dont start ViewServer',
+ 'S': 'don\'t start ViewServer',
+ 'k': 'don\'t ignore UiAutomator killed',
'w': 'dump WINDOW content (default: -1, all windows)',
'i': 'dump View unique IDs',
'x': 'dump View positions',
@@ -126,6 +128,8 @@ for o, a in opts:
kwargs2['forceviewserveruse'] = True
elif o in ['S', DO_NOT_START_VIEW_SERVER]:
kwargs2['startviewserver'] = False
+ elif o in ['k', DO_NOT_IGNORE_UIAUTOMATOR_KILLED]:
+ kwargs2['ignoreuiautomatorkilled'] = False
elif o in ['w', WINDOW]:
options[WINDOW] = a
else:

0 comments on commit 054433b

Please sign in to comment.