MCPcopy Create free account
hub / github.com/dtmilano/AndroidViewClient / obtain_selector

Method obtain_selector

src/com/dtmilano/android/viewclient.py:1048–1068  ·  view source on GitHub ↗

Obtains a Selector for this View. :return: the Selector or None if the most important values (e.g. text, res, etc.) are not present

(self)

Source from the content-addressed store, hash-verified

1046 return selector
1047
1048 def obtain_selector(self) -> Optional[culebratester_client.Selector]:
1049 """
1050 Obtains a Selector for this View.
1051
1052 :return: the Selector or None if the most important values (e.g. text, res, etc.) are not present
1053 """
1054 if DEBUG_SELECTOR:
1055 print(f'obtain_selector: view={self}', file=sys.stderr)
1056 selector = culebratester_client.Selector()
1057 selector.desc = self.getContentDescription()
1058 selector.text = self.getText()
1059 res = self.getId()
1060 selector.res = res if res else None
1061 selector.clazz = self.getClass()
1062 selector.pkg = self.getPackage()
1063 selector.clickable = self.isClickable()
1064 selector.checkable = self.isCheckable()
1065 if selector.desc or selector.text or selector.res or selector.clazz:
1066 # If we have some of these values let's return the selector
1067 return selector
1068 return None
1069
1070 def longTouch(self, duration=2000):
1071 """

Callers 6

touchMethod · 0.95
longTouchMethod · 0.95
touchViewMethod · 0.80
longTouchViewMethod · 0.80
setTextMethod · 0.80

Calls 5

getContentDescriptionMethod · 0.95
getTextMethod · 0.95
getIdMethod · 0.95
getClassMethod · 0.95
isClickableMethod · 0.95

Tested by

no test coverage detected