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

Method setText

src/com/dtmilano/android/viewclient.py:4212–4227  ·  view source on GitHub ↗
(self, v, text)

Source from the content-addressed store, hash-verified

4210 warnings.warn("pressKeyCode only implemented using UiAutomatorHelper. Use AdbClient.type() instead")
4211
4212 def setText(self, v, text):
4213 if DEBUG:
4214 print("setText(%s, '%s')" % (v.__tinyStr__(), text), file=sys.stderr)
4215 if self.uiAutomatorHelper:
4216 if DEBUG_UI_AUTOMATOR_HELPER:
4217 print("Setting text through UiAutomatorHelper for View with ID=%s" % v.getId(), file=sys.stderr)
4218 selector = v.obtain_selector()
4219 obj_ref = self.uiAutomatorHelper.until.find_object(body=selector)
4220 response = self.uiAutomatorHelper.ui_device.wait(obj_ref.oid)
4221 self.uiAutomatorHelper.ui_object2.set_text(response['oid'], text)
4222 else:
4223 # This is deleting the existing text, which should be asked in the dialog, but I would have to implement
4224 # the dialog myself
4225 v.setText(text)
4226 # This is not deleting the text, so appending if there's something
4227 # v.type(text)
4228
4229 @staticmethod
4230 def sayText(text, voice=None, verbose=False):

Callers

nothing calls this directly

Calls 7

__tinyStr__Method · 0.80
getIdMethod · 0.80
obtain_selectorMethod · 0.80
waitMethod · 0.80
set_textMethod · 0.80
find_objectMethod · 0.45
setTextMethod · 0.45

Tested by

no test coverage detected