|
18 | 18 | @author: Diego Torres Milano |
19 | 19 | ''' |
20 | 20 |
|
21 | | -__version__ = '12.0.2' |
| 21 | +__version__ = '12.0.3' |
22 | 22 |
|
23 | 23 | import os |
24 | 24 | import subprocess |
@@ -246,7 +246,7 @@ def findObject(self, **kwargs): |
246 | 246 | if r[u'status'] == 'OK': |
247 | 247 | if DEBUG: |
248 | 248 | print >> sys.stderr, "UiAutomatorHelper: findObject: returning", int(r[u'oid']) |
249 | | - return UiObject(self, int(r[u'oid'])) |
| 249 | + return UiObject2(self, int(r[u'oid'])) |
250 | 250 | raise RuntimeError("Error: " + response) |
251 | 251 |
|
252 | 252 | def longClick(self, **kwargs): |
@@ -291,17 +291,45 @@ def setText(self, uiObject, text): |
291 | 291 | params = {'text': text} |
292 | 292 | return self.__httpCommand('/UiObject/0x%x/setText' % (uiObject.oid), params) |
293 | 293 |
|
| 294 | + # |
| 295 | + # UiObject2 |
| 296 | + # |
| 297 | + def clickAndWait(self, uiObject2, eventCondition, timeout): |
| 298 | + params = {'eventCondition': eventCondition, 'timeout': timeout} |
| 299 | + return self.__httpCommand('/UiObject2/0x%x/clickAndWait' % (uiObject2.oid), params) |
| 300 | + |
| 301 | + |
| 302 | + # |
| 303 | + # UiScrollable |
| 304 | + # |
| 305 | + def uiScrollable(self, path, params): |
| 306 | + return self.__httpCommand('/UiScrollable/' + path, params) |
| 307 | + |
294 | 308 |
|
295 | | -class UiObject: |
| 309 | +class UiObject2: |
296 | 310 | def __init__(self, uiAutomatorHelper, oid): |
297 | 311 | self.uiAutomatorHelper = uiAutomatorHelper |
298 | 312 | self.oid = oid |
299 | 313 |
|
300 | 314 | def click(self): |
301 | 315 | self.uiAutomatorHelper.click(oid=self.oid) |
302 | 316 |
|
| 317 | + def clickAndWait(self, eventCondition, timeout): |
| 318 | + self.uiAutomatorHelper.clickAndWait(uiObject2=self, eventCondition=eventCondition, timeout=timeout) |
| 319 | + |
| 320 | + |
303 | 321 | def longClick(self): |
304 | 322 | self.uiAutomatorHelper.longClick(oid=self.oid) |
305 | 323 |
|
306 | 324 | def setText(self, text): |
307 | 325 | self.uiAutomatorHelper.setText(uiObject=self, text=text) |
| 326 | + |
| 327 | + |
| 328 | +class UiScrollable: |
| 329 | + def __init__(self, uiAutomatorHelper, selector): |
| 330 | + self.uiAutomatorHelper = uiAutomatorHelper |
| 331 | + self.selector = selector |
| 332 | + |
| 333 | + def createUiScrollable(self): |
| 334 | + return self.uiAutomatorHelper.uiScrollable('new', {'uiSelector': self.selector}) |
| 335 | + |
0 commit comments