This function makes sure that any previously entered text is deleted before setting the value of the field.
(self, text)
| 1326 | time.sleep(0.5) |
| 1327 | |
| 1328 | def setText(self, text): |
| 1329 | """ |
| 1330 | This function makes sure that any previously entered text is deleted before |
| 1331 | setting the value of the field. |
| 1332 | """ |
| 1333 | if self.text() == text: |
| 1334 | return |
| 1335 | self.touch() |
| 1336 | maxSize = len(self.text()) + 1 |
| 1337 | self.device.press('KEYCODE_DEL', adbclient.DOWN_AND_UP, repeat=maxSize) |
| 1338 | self.device.press('KEYCODE_FORWARD_DEL', adbclient.DOWN_AND_UP, repeat=maxSize) |
| 1339 | self.type(text, alreadyTouched=True) |
| 1340 | |
| 1341 | def backspace(self): |
| 1342 | self.touch() |