Skip to content

Commit 1902b4b

Browse files
committed
Add until find objects
1 parent b830823 commit 1902b4b

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@
2222
classifiers=['Development Status :: 5 - Production/Stable',
2323
'Intended Audience :: Developers',
2424
'License :: OSI Approved :: Apache Software License'],
25-
install_requires=['setuptools', 'requests', 'numpy', 'matplotlib', 'culebratester-client >= 2.0.39'],
25+
install_requires=['setuptools', 'requests', 'numpy', 'matplotlib', 'culebratester-client >= 2.0.41'],
2626
)

src/com/dtmilano/android/uiautomator/uiautomatorhelper.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
from __future__ import print_function
2222

23-
__version__ = '21.11.2'
23+
__version__ = '21.11.3'
2424

2525
import json
2626
import os
@@ -401,6 +401,7 @@ def dump_window_hierarchy(self, _format='JSON'):
401401
def find_object(self, **kwargs):
402402
"""
403403
Finds an object.
404+
Invokes GET or POST method depending on the arguments passed.
404405
405406
:see https://github.com/dtmilano/CulebraTester2-public/blob/master/openapi.yaml
406407
:param kwargs:
@@ -648,6 +649,21 @@ def find_object(self, **kwargs) -> ObjectRef:
648649
body = culebratester_client.Selector(**kwargs)
649650
return self.uiAutomatorHelper.api_instance.until_find_object_post(body=body)
650651

652+
def find_objects(self, **kwargs) -> ObjectRef:
653+
"""
654+
Returns a SearchCondition that is satisfied when at least one element matching the selector can be found.
655+
The condition will return the first matching element.
656+
:see https://github.com/dtmilano/CulebraTester2-public/blob/master/openapi.yaml
657+
:param kwargs: the arguments
658+
:return: the search condition reference
659+
"""
660+
if 'body' in kwargs:
661+
return self.uiAutomatorHelper.api_instance.until_find_objects_post(**kwargs)
662+
if 'by_selector' in kwargs:
663+
return self.uiAutomatorHelper.api_instance.until_find_objects_get(**kwargs)
664+
body = culebratester_client.Selector(**kwargs)
665+
return self.uiAutomatorHelper.api_instance.until_find_objects_post(body=body)
666+
651667
def new_window(self) -> ObjectRef:
652668
"""
653669
Returns a condition that depends on a new window having appeared.

0 commit comments

Comments
 (0)