1 from __future__ import print_function
8 def sendKey(stub, key):
9 rsp_key = stub.sendKey(aurum_pb2.ReqKey(
16 def launchApp(stub, pkgname):
17 rsp_launch = stub.launchApp(aurum_pb2.ReqLaunchApp(
21 def closeApp(stub, pkgname):
22 rsp_launch = stub.closeApp(aurum_pb2.ReqCloseApp(
26 def getAppInfo(stub, pkgname):
27 rsp_info = stub.getAppInfo(aurum_pb2.ReqGetAppInfo(packageName=pkgname))
30 def touchdown(stub, xx, yy):
31 rsp = stub.touchDown(aurum_pb2.ReqTouchDown(coordination=aurum_pb2.Point(x=xx,y=yy)))
34 def touchmove(stub, xx, yy):
35 rsp = stub.touchMove(aurum_pb2.ReqTouchMove(coordination=aurum_pb2.Point(x=xx,y=yy)))
38 def touchup(stub, xx, yy):
39 rsp = stub.touchUp(aurum_pb2.ReqTouchUp(coordination=aurum_pb2.Point(x=xx,y=yy)))
43 touchdown(stub, 630,1140)
45 touchup(stub, 630,1140)
48 def findElementByText(stub, text):
49 rsp_find = stub.findElement(aurum_pb2.ReqFindElement(
54 for item in rsp_find.elements:
58 def findElementsByText(stub, text):
59 rsp_find = stub.findElement(aurum_pb2.ReqFindElement(
65 for el in rsp_find.elements:
66 els.append(el.elementId)
69 def clickById(stub, id):
70 stub.click(aurum_pb2.ReqClick(
77 foundId = findElementByText(stub, 'All apps')
80 clickById(stub, foundId)
83 foundId = findElementByText(stub, 'Memo')
86 clickById(stub, foundId)
89 def set_text(stub, text):
90 foundIds = findElementsByText(stub, "Memo")
91 foundIds += (findElementsByText(stub, "Title"))
95 stub.setValue(aurum_pb2.ReqSetValue(
99 #foundId = findElementByText(stub, 'DONE')
101 # clickById(stub, foundId)
104 with grpc.insecure_channel('127.0.0.1:50051') as channel:
105 stub = aurum_pb2_grpc.BootstrapStub(channel)
106 set_text(stub, 'hello')
108 if __name__ == '__main__':
109 logging.basicConfig()