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(
78 def getAttrById(stub, id, attr):
79 rsp = stub.getAttribute(aurum_pb2.ReqGetAttribute(attribute=attr, elementId=id))
83 foundId = findElementByText(stub, 'All apps')
86 getAttrById(stub, foundId, 'VISIBLE')
87 getAttrById(stub, foundId, 'CLICKABLE')
88 getAttrById(stub, foundId, 'FOCUSED')
89 getAttrById(stub, foundId, 'ENABLED')
90 getAttrById(stub, foundId, 'CHECKED')
91 clickById(stub, foundId)
94 foundId = findElementByText(stub, 'Memo')
97 clickById(stub, foundId)
100 def set_text(stub, text):
101 foundId = findElementByText(stub, 'Title')
103 clickById(stub, foundId)
105 stub.setValue(aurum_pb2.ReqSetValue(
108 foundIds = findElementsByText(stub, "Memo")
109 if len(foundIds) >= 2:
110 stub.setValue(aurum_pb2.ReqSetValue(
111 elementId=foundIds[1].elementId,
114 foundId = findElementByText(stub, 'DONE')
116 clickById(stub, foundId)
120 with grpc.insecure_channel('127.0.0.1:50051') as channel:
121 stub = aurum_pb2_grpc.BootstrapStub(channel)
123 getAppInfo(stub, 'org.tizen.memo')
125 sendKey(stub, 'HOME')
127 closeApp(stub, 'org.tizen.memo')
129 getAppInfo(stub, 'org.tizen.memo')
135 set_text(stub, 'hello')
137 if __name__ == '__main__':
138 logging.basicConfig()