File tree Expand file tree Collapse file tree
AndroidViewClient/examples Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3131from com .android .monkeyrunner import MonkeyRunner , MonkeyDevice
3232
3333# Starting: Intent { act=android.intent.action.MAIN flg=0x10000000 cmp=com.android.browser/.BrowserActivity }
34- package = 'com.android.browser'
35- activity = '.BrowserActivity'
34+ package = 'com.android.browser'
35+ activity = '.BrowserActivity'
3636component = package + "/" + activity
3737uri = 'http://dtmilano.blogspot.com'
3838
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env monkeyrunner
2+ '''
3+ Copyright (C) 2012 Diego Torres Milano
4+ Created on Feb 3, 2012
5+
6+ @author: diego
7+ '''
8+
9+
10+ import sys
11+ import os
12+ import re
13+ import time
14+
15+ # This must be imported before MonkeyRunner and MonkeyDevice,
16+ # otherwise the import fails.
17+ # PyDev sets PYTHONPATH, use it
18+ try :
19+ for p in os .environ ['PYTHONPATH' ].split (':' ):
20+ if not p in sys .path :
21+ sys .path .append (p )
22+ except :
23+ pass
24+
25+ try :
26+ sys .path .append (os .path .join (os .environ ['ANDROID_VIEW_CLIENT_HOME' ], 'src' ))
27+ except :
28+ pass
29+
30+ from com .dtmilano .android .viewclient import *
31+
32+ package = 'com.android.gallery'
33+ activity = 'com.android.camera.GalleryPicker'
34+ component = package + "/" + activity
35+
36+ device , serialno = ViewClient .connectToDeviceOrExit ()
37+ device .startActivity (component = component )
38+ time .sleep (3 )
39+ vc = ViewClient (device , serialno )
40+ if vc .build [VERSION_SDK_PROPERTY ] != 15 :
41+ print 'This script is intended to run on API-15'
42+ ALL_PICTURES = 'All pictures'
43+ vc .findViewWithTextOrRaise (re .compile ('%s \(\d+\)' % ALL_PICTURES )).touch ()
44+ vc .dump ()
45+ vc .findViewWithTextOrRaise (ALL_PICTURES )
46+ print "'%s' found" % ALL_PICTURES
You can’t perform that action at this time.
0 commit comments