Форум сайта python.su
Использую инструмент Moneyrunner он взаимодействует с Android через Py скрипты
from __future__ import with_statement import os from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice def record(): with open('C:\op\link.txt') as inp : try: temp = inp.readlines() url = temp.pop(0) with open ('C:\op\link.txt','w') as out: for i in temp : out.write( i) return ''.join(['', url] ) except IndexError: print('1') PACKAGE = 'com.android.browser' ACTIVITY = '.BrowserActivity' COMPONENT = PACKAGE + "/" + ACTIVITY URI = record() device = MonkeyRunner.waitForConnection(0.1,'1777cda7') device.startActivity(component=COMPONENT, uri=URI)
import sys import os import time try: sys.path.append(os.path.join(os.environ['ANDROID_VIEW_CLIENT_HOME'], 'src')) except: pass from com.dtmilano.android.viewclient import ViewClient vc = ViewClient(*ViewClient.connectToDeviceOrExit()) for bt in [ 'One', 'Two', 'Three', 'Four', 'Five' ]: b = vc.findViewWithText(bt) if b: (x, y) = b.getXY() print >>sys.stderr, "clicking b%s @ (%d,%d) ..." % (bt, x, y) b.touch() else: print >>sys.stderr, "b%s not found" % bt time.sleep(7) print >>sys.stderr, "bye"
Офлайн