I am trying to delete text from a text field using monkeyrunner API . I am writing script in python.
There are key events like " KEYCODE_FORWARD_DEL","KEYCODE_DEL" and to move the cursor to the end "KEYCODE_MOVE_END".
I am trying to delete text, for this, I tried to move the cursor to the end but"KEYCODE_MOVE_END" did not work. Cursor did not move at all.
Then, I tried to use " KEYCODE_FORWARD_DEL" but it also did not work.
These, keys are working for the text field in which I entered text using my script, but these are not working for the fields, which were already filled.
Can any one, please guide me?
This worked for me, though haven't tried setting a Exchange account:
fieldLength = 50
# select all the chars
self.device.press('KEYCODE_SHIFT_LEFT', MonkeyDevice.DOWN)
for i in range(fieldLength):
self.device.press('KEYCODE_DPAD_LEFT', MonkeyDevice.DOWN_AND_UP)
MonkeyRunner.sleep(1)
self.device.press('KEYCODE_SHIFT_LEFT', MonkeyDevice.UP)
# delete them
self.device.press('KEYCODE_DEL', MonkeyDevice.DOWN_AND_UP)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With