#! /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'
Example #2
0
#! /usr/bin/env python
'''
Copyright (C) 2012  Diego Torres Milano
Created on Aug 7, 2012
@author: diego
'''
import sys
import os
try:
    sys.path.append(os.path.join(os.environ['ANDROID_VIEW_CLIENT_HOME'],
                                 'src'))
except:
    pass
from androidviewclient3.viewclient import ViewClient
vc = ViewClient(*ViewClient.connectToDeviceOrExit())
for i in range(1, 9):
    view = vc.findViewById("id/no_id/%d" % i)
    if view:
        print(view.__tinyStr__())
        view.touch()

#! /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
device, serialno = ViewClient.connectToDeviceOrExit()
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'
componentName = 'com.dtmilano.android.sampleui/.MainActivity'
Example #4
0
#! /usr/bin/env python
'''
Copyright (C) 2012  Diego Torres Milano
Created on Feb 1, 2012
@author: diego
'''
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
package = 'com.android.settings'
activity = '.Settings'
component = package + "/" + activity
device, serialno = ViewClient.connectToDeviceOrExit()
if True:
    device.startActivity(component=component)