Skip to content

Commit 304bf03

Browse files
committed
Added gallery-select-album example
1 parent a0d3424 commit 304bf03

2 files changed

Lines changed: 48 additions & 2 deletions

File tree

AndroidViewClient/examples/browser-open-url.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
from 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'
3636
component = package + "/" + activity
3737
uri = 'http://dtmilano.blogspot.com'
3838

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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

0 commit comments

Comments
 (0)