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(
55 textField=text, isEnabled=False
58 for item in rsp_find.elements:
62 def findElementsByText(stub, text):
63 rsp_find = stub.findElement(aurum_pb2.ReqFindElement(
67 return rsp_find.elements
69 def clickById(stub, id):
70 stub.click(aurum_pb2.ReqClick(
76 def getAttrById(stub, id, attr):
77 rsp = stub.getAttribute(aurum_pb2.ReqGetAttribute(attribute=attr, elementId=id))
81 foundId = findElementByText(stub, 'All apps')
84 getAttrById(stub, foundId, 'VISIBLE')
85 getAttrById(stub, foundId, 'CLICKABLE')
86 getAttrById(stub, foundId, 'FOCUSED')
87 getAttrById(stub, foundId, 'ENABLED')
88 getAttrById(stub, foundId, 'CHECKED')
89 clickById(stub, foundId)
92 foundId = findElementByText(stub, 'Memo')
95 clickById(stub, foundId)
98 def set_text(stub, text):
99 foundId = findElementByText(stub, 'Title')
101 clickById(stub, foundId)
103 stub.setValue(aurum_pb2.ReqSetValue(
106 foundIds = findElementsByText(stub, "Memo")
107 if len(foundIds) >= 2:
108 stub.setValue(aurum_pb2.ReqSetValue(
109 elementId=foundIds[1].elementId,
112 foundId = findElementByText(stub, 'DONE')
114 clickById(stub, foundId)
117 with grpc.insecure_channel('127.0.0.1:50051') as channel:
118 stub = aurum_pb2_grpc.BootstrapStub(channel)
120 appid='org.tizen.elm-demo-tizen-mobile'
121 getAppInfo(stub, appid)
122 sendKey(stub, 'HOME')
123 closeApp(stub, appid)
124 getAppInfo(stub, appid)
125 launchApp(stub, appid)
126 foundId = findElementByText(stub, "Radio")
127 print('--------' + foundId)
128 getAttrById(stub, foundId, 'VISIBLE')
129 getAttrById(stub, foundId, 'CLICKABLE')
130 getAttrById(stub, foundId, 'FOCUSED')
131 getAttrById(stub, foundId, 'ENABLED')
132 getAttrById(stub, foundId, 'CHECKED')
133 getAttrById(stub, foundId, 'SHOWING')
135 foundId = findElementByText(stub, "Button")
137 getAttrById(stub, foundId, 'VISIBLE')
138 getAttrById(stub, foundId, 'CLICKABLE')
139 getAttrById(stub, foundId, 'FOCUSED')
140 getAttrById(stub, foundId, 'ENABLED')
141 getAttrById(stub, foundId, 'CHECKED')
142 getAttrById(stub, foundId, 'SHOWING')
145 clickById(stub, foundId)
147 if __name__ == '__main__':
148 logging.basicConfig()