|
20 | 20 |
|
21 | 21 | from __future__ import print_function |
22 | 22 |
|
23 | | -__version__ = '22.3.1' |
| 23 | +__version__ = '22.4.0' |
24 | 24 |
|
25 | 25 | import os |
26 | 26 | import platform |
|
36 | 36 |
|
37 | 37 | import culebratester_client |
38 | 38 | from culebratester_client import Text, ObjectRef, DefaultApi, Point, PerformTwoPointerGestureBody, \ |
39 | | - BooleanResponse, NumberResponse, StatusResponse |
| 39 | + BooleanResponse, NumberResponse, StatusResponse, StringResponse |
40 | 40 |
|
41 | 41 | from com.dtmilano.android.adb.adbclient import AdbClient |
42 | 42 | from com.dtmilano.android.common import obtainAdbPath |
@@ -465,7 +465,7 @@ def find_object(self, **kwargs): |
465 | 465 | """ |
466 | 466 | if 'body' in kwargs: |
467 | 467 | return self.uiAutomatorHelper.api_instance.ui_device_find_object_post(**kwargs) |
468 | | - if self.some(['resource_id', 'ui_selector', 'by_selector'], kwargs): |
| 468 | + if self.some(['resource_id', 'ui_selector', 'by_selector'], list(kwargs.keys())): |
469 | 469 | return self.uiAutomatorHelper.api_instance.ui_device_find_object_get(**kwargs) |
470 | 470 | body = culebratester_client.Selector(**kwargs) |
471 | 471 | return self.uiAutomatorHelper.api_instance.ui_device_find_object_post(body=body) |
@@ -664,13 +664,35 @@ def exists(self, oid: int) -> bool: |
664 | 664 |
|
665 | 665 | def get_child_count(self, oid: int) -> int: |
666 | 666 | """ |
| 667 | + Counts the child views immediately under the present UiObject. |
667 | 668 | :see https://github.com/dtmilano/CulebraTester2-public/blob/master/openapi.yaml |
668 | | - :param oid: |
669 | | - :return: |
| 669 | + :param oid: the oid |
| 670 | + :return: the child count |
670 | 671 | """ |
671 | 672 | response: NumberResponse = self.uiAutomatorHelper.api_instance.ui_object_oid_get_child_count_get(oid=oid) |
672 | 673 | return int(response.value) |
673 | 674 |
|
| 675 | + def get_class_name(self, oid: int) -> str: |
| 676 | + """ |
| 677 | + Retrieves the className property of the UI element. |
| 678 | + :see https://github.com/dtmilano/CulebraTester2-public/blob/master/openapi.yaml |
| 679 | + :param oid: |
| 680 | + :return: the class name |
| 681 | + """ |
| 682 | + response: StringResponse = self.uiAutomatorHelper.api_instance.ui_object_oid_get_class_name_get(oid=oid) |
| 683 | + return response.value |
| 684 | + |
| 685 | + def get_content_description(self, oid: int) -> str: |
| 686 | + """ |
| 687 | + Reads the content_desc property of the UI element. |
| 688 | + :see https://github.com/dtmilano/CulebraTester2-public/blob/master/openapi.yaml |
| 689 | + :param oid: the oid |
| 690 | + :return: the content description |
| 691 | + """ |
| 692 | + response: StringResponse = self.uiAutomatorHelper.api_instance.ui_object2_oid_get_content_description_get( |
| 693 | + oid=oid) |
| 694 | + return response.value |
| 695 | + |
674 | 696 | def perform_two_pointer_gesture(self, oid: int, startPoint1: Tuple[int, int], startPoint2: Tuple[int, int], |
675 | 697 | endPoint1: Tuple[int, int], endPoint2: Tuple[int, int], steps: int) -> None: |
676 | 698 | """ |
|
0 commit comments