extra=get_extra_data()) vc.dump() com_whatsapp___id_pickfiletype_gallery = vc.findViewByIdOrRaise( "com.whatsapp:id/pickfiletype_gallery") com_whatsapp___id_pickfiletype_gallery.touch() logger.info('click Gallery', extra=get_extra_data()) vc.dump() com_whatsapp___id_title = vc.findViewWithTextOrRaise( u'Camera') com_whatsapp___id_title.touch() logger.info('click Camera folder', extra=get_extra_data()) vc.dump() no_id7 = vc.findViewWithContentDescriptionOrRaise( u'''Photo''') no_id7.touch() logger.info('select photo', extra=get_extra_data()) #ViewClient.sleep(10) vc.dump() ViewClient.sleep(5) com_whatsapp___id_send = vc.findViewByIdOrRaise( "com.whatsapp:id/send") com_whatsapp___id_send.touch() logger.info('click send button', extra=get_extra_data()) # wait ViewClient.sleep(13) break break
__ __ __ __ / \ / \ / \ / \ ____________________/ __\/ __\/ __\/ __\_____________________________ ___________________/ /__/ /__/ /__/ /________________________________ | / \ / \ / \ / \ \___ |/ \_/ \_/ \_/ \ o \ \_____/--< @author: Diego Torres Milano @author: Jennifer E. Swofford (ascii art snake) ''' import re import sys import os from com.dtmilano.android.viewclient import ViewClient if len(sys.argv) < 2: sys.exit("usage: %s /path/to/filename.png [serialno]" % sys.argv[0]) filename = sys.argv.pop(1) kwargs1 = {'verbose': False, 'ignoresecuredevice': False} device, serialno = ViewClient.connectToDeviceOrExit(**kwargs1) kwargs2 = {'startviewserver': True, 'forceviewserveruse': False, 'autodump': False, 'ignoreuiautomatorkilled': True} vc = ViewClient(device, serialno, **kwargs2) vc.dump(window='-1') vc.findViewWithContentDescriptionOrRaise('''Home screen 3''').writeImageToFile(filename, 'PNG')
import re import sys import os try: sys.path.insert(0, os.path.join(os.environ['ANDROID_VIEW_CLIENT_HOME'], 'src')) except: pass from com.dtmilano.android.viewclient import ViewClient TAG = 'CULEBRA' _s = 5 _v = '--verbose' in sys.argv kwargs1 = {'ignoreversioncheck': False, 'verbose': False, 'ignoresecuredevice': False} device, serialno = ViewClient.connectToDeviceOrExit(**kwargs1) kwargs2 = {'forceviewserveruse': False, 'useuiautomatorhelper': False, 'ignoreuiautomatorkilled': True, 'autodump': False, 'startviewserver': True, 'compresseddump': True} vc = ViewClient(device, serialno, **kwargs2) vc.dump(window=-1) vc.findViewWithContentDescriptionOrRaise(u'''Voice Search''').touch() ViewClient.sayText("The 'poke' button on facebook is awesome...\ But I think there should be a 'stab' button...") vc.sleep(_s) vc.dump(window=-1)
package = 'com.example.i2at.tc' activity = '.TemperatureConverterActivity' componentName = package + "/" + activity device.startActivity(component=componentName, flags=FLAG_ACTIVITY_NEW_TASK) time.sleep(5) device.type("123") time.sleep(3) vc = ViewClient(device, serialno, startviewserver=(not localViewServer)) if vc.build['ro.build.version.sdk'] >= 16: # obtain the views by contentDescription celsius = vc.findViewWithContentDescriptionOrRaise("celsius") fahrenheit = vc.findViewWithContentDescriptionOrRaise("fahrenheit") else: # obtain the views by id celsius = vc.findViewByIdOrRaise("id/celsius") fahrenheit = vc.findViewByIdOrRaise("id/fahrenheit") ct = celsius.getText() if ct: c = float(ct) else: print >> sys.stderr, "Celsius is empty" sys.exit(1) ft = fahrenheit.getText() if ft: f = float(ft)
kwargs1 = {'ignoreversioncheck': False, 'verbose': False, 'ignoresecuredevice': False} device, serialno = ViewClient.connectToDeviceOrExit(**kwargs1) device.startActivity(component='com.restwla.z'+appid+'/com.application.zomato.bake.prototype.activities.SplashActivity') kwargs2 = {'forceviewserveruse': False, 'useuiautomatorhelper': False, 'ignoreuiautomatorkilled': True, 'autodump': False, 'startviewserver': True, 'compresseddump': True} vc = ViewClient(device, serialno, **kwargs2) #vc.dump(window='-1') # FIXME: seems not needed vc.sleep(_s) vc.dump(window='-1') #select outlet skip if vc.findViewWithText('Select an Outlet'): vc.findViewWithContentDescriptionOrRaise(u'''Outlet''').touch() vc.sleep(_s) #screenshot of home screen device.takeSnapshot().save(path+'/whitelabel/WLA_database/'+appid+'/screenshots/1.png','PNG') vc.dump(window='-1') vc.sleep(_s) vc.dump(window='-1') #Theme 1 = STACK STACK if vc.findViewWithContentDescription(u'''stack_stack'''): id_scroll_view = vc.findViewByIdOrRaise("com.restwla.z"+appid+":id/scroll_view") #screenshot of information page vc.findViewByIdOrRaise('com.restwla.z'+appid+':id/home_option_information').touch() vc.sleep(_s)
# Author: Botao Sun <*****@*****.**> # First touch on GLBenchmark import time import re from com.dtmilano.android.viewclient import ViewClient device, serialno = ViewClient.connectToDeviceOrExit() vc = ViewClient(device, serialno) time.sleep(2) apps_tab = vc.findViewWithContentDescriptionOrRaise(re.compile('Apps')) apps_tab.touch() time.sleep(5) vc.dump(window='-1') target_app = vc.findViewWithText("GLBenchmark 2.5.1") target_app.touch() print "GLBenchmark 2.5.1 touched!" time.sleep(15) device.press('KEYCODE_BACK') time.sleep(3)
| / \ / \ / \ / \ \___ |/ \_/ \_/ \_/ \ o \ \_____/--< @author: Diego Torres Milano @author: Jennifer E. Swofford (ascii art snake) ''' import re import sys import os from com.dtmilano.android.viewclient import ViewClient if len(sys.argv) < 2: sys.exit("usage: %s /path/to/filename.png [serialno]" % sys.argv[0]) filename = sys.argv.pop(1) kwargs1 = {'verbose': False, 'ignoresecuredevice': False} device, serialno = ViewClient.connectToDeviceOrExit(**kwargs1) kwargs2 = { 'startviewserver': True, 'forceviewserveruse': False, 'autodump': False, 'ignoreuiautomatorkilled': True } vc = ViewClient(device, serialno, **kwargs2) vc.dump(window='-1') vc.findViewWithContentDescriptionOrRaise('''Home screen 3''').writeImageToFile( filename, 'PNG')
@author: Jennifer E. Swofford (ascii art snake) ''' import sys from com.dtmilano.android.viewclient import ViewClient TAG = 'CULEBRA' _s = 5 _v = '--verbose' in sys.argv kwargs1 = { 'ignoreversioncheck': False, 'verbose': False, 'ignoresecuredevice': False } device, serialno = ViewClient.connectToDeviceOrExit(**kwargs1) kwargs2 = { 'forceviewserveruse': False, 'useuiautomatorhelper': False, 'ignoreuiautomatorkilled': True, 'autodump': False, 'startviewserver': True, 'compresseddump': True } vc = ViewClient(device, serialno, **kwargs2) vc.dump(window=-1) vc.findViewWithContentDescriptionOrRaise(u'''Conversations Button''').touch() vc.sleep(_s)
from com.dtmilano.android.viewclient import ViewClient TAG = 'CULEBRA' _s = 5 _v = '--verbose' in sys.argv kwargs1 = { 'ignoreversioncheck': False, 'verbose': False, 'ignoresecuredevice': False } device, serialno = ViewClient.connectToDeviceOrExit(**kwargs1) kwargs2 = { 'forceviewserveruse': False, 'useuiautomatorhelper': False, 'ignoreuiautomatorkilled': True, 'autodump': False, 'startviewserver': True, 'compresseddump': True } vc = ViewClient(device, serialno, **kwargs2) vc.dump(window=-1) vc.findViewWithContentDescriptionOrRaise(u'''Voice Search''').touch() ViewClient.sayText("The 'poke' button on facebook is awesome...\ But I think there should be a 'stab' button...") vc.sleep(_s) vc.dump(window=-1)
FLAG_ACTIVITY_NEW_TASK = 0x10000000 package = 'com.example.i2at.tc' activity = '.TemperatureConverterActivity' componentName = package + "/" + activity device.startActivity(component=componentName, flags=FLAG_ACTIVITY_NEW_TASK) time.sleep(5) device.type("123") time.sleep(3) vc = ViewClient(device, serialno, startviewserver=(not localViewServer)) if vc.build['ro.build.version.sdk'] >= 16: # obtain the views by contentDescription celsius = vc.findViewWithContentDescriptionOrRaise("celsius") fahrenheit = vc.findViewWithContentDescriptionOrRaise("fahrenheit") else: # obtain the views by id celsius = vc.findViewByIdOrRaise("id/celsius") fahrenheit = vc.findViewByIdOrRaise("id/fahrenheit") ct = celsius.getText() if ct: c = float(ct) else: print >> sys.stderr, "Celsius is empty" sys.exit(1) ft = fahrenheit.getText() if ft: f = float(ft)