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 rsp = stub.sync(aurum_pb2.ReqEmpty())
48 touchdown(stub, 630,1140)
50 touchup(stub, 630,1140)
53 def findElementByText(stub, text):
54 rsp_find = stub.findElement(aurum_pb2.ReqFindElement(
59 for item in rsp_find.elements:
63 def findElementsByText(stub, text):
64 rsp_find = stub.findElement(aurum_pb2.ReqFindElement(
69 return rsp_find.elements
71 def clickById(stub, id):
72 stub.click(aurum_pb2.ReqClick(
79 foundId = findElementByText(stub, 'All apps')
82 clickById(stub, foundId)
85 foundId = findElementByText(stub, 'Memo')
88 clickById(stub, foundId)
91 def set_text(stub, text):
92 foundId = findElementByText(stub, 'Title')
94 clickById(stub, foundId)
96 stub.setValue(aurum_pb2.ReqSetValue(
99 foundIds = findElementsByText(stub, "Memo")
100 if len(foundIds) >= 2:
101 stub.setValue(aurum_pb2.ReqSetValue(
102 elementId=foundIds[1].elementId,
105 foundId = findElementByText(stub, 'DONE')
107 clickById(stub, foundId)
111 with grpc.insecure_channel('127.0.0.1:50051') as channel:
112 stub = aurum_pb2_grpc.BootstrapStub(channel)
114 getAppInfo(stub, 'org.tizen.memo')
116 sendKey(stub, 'HOME')
118 closeApp(stub, 'org.tizen.memo')
120 getAppInfo(stub, 'org.tizen.memo')
126 set_text(stub, 'hello')
128 if __name__ == '__main__':
129 logging.basicConfig()