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(
64 return rsp_find.elements
66 def clickById(stub, id):
67 stub.click(aurum_pb2.ReqClick(
73 def getAttrById(stub, id, attr):
74 rsp = stub.getAttribute(aurum_pb2.ReqGetAttribute(attribute=attr, elementId=id))
78 foundId = findElementByText(stub, 'All apps')
81 getAttrById(stub, foundId, 'VISIBLE')
82 getAttrById(stub, foundId, 'CLICKABLE')
83 getAttrById(stub, foundId, 'FOCUSED')
84 getAttrById(stub, foundId, 'ENABLED')
85 getAttrById(stub, foundId, 'CHECKED')
86 clickById(stub, foundId)
89 foundId = findElementByText(stub, 'Memo')
92 clickById(stub, foundId)
95 def set_text(stub, text):
96 foundId = findElementByText(stub, 'Title')
98 clickById(stub, foundId)
100 stub.setValue(aurum_pb2.ReqSetValue(
103 foundIds = findElementsByText(stub, "Memo")
104 if len(foundIds) >= 2:
105 stub.setValue(aurum_pb2.ReqSetValue(
106 elementId=foundIds[1].elementId,
109 foundId = findElementByText(stub, 'DONE')
111 clickById(stub, foundId)
114 with grpc.insecure_channel('127.0.0.1:50051') as channel:
115 stub = aurum_pb2_grpc.BootstrapStub(channel)
117 getAppInfo(stub, 'org.tizen.memo')
119 sendKey(stub, 'HOME')
121 closeApp(stub, 'org.tizen.memo')
123 getAppInfo(stub, 'org.tizen.memo')
129 set_text(stub, 'hello')
131 if __name__ == '__main__':
132 logging.basicConfig()