如何从文本字段使用删除文本monkeyrunner API(Python脚本) [英] how to delete text from a text field using monkeyrunner API (Python script)

查看:454
本文介绍了如何从文本字段使用删除文本monkeyrunner API(Python脚本)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想删除使用monkeyrunner API文本字段中的文本。我在python写剧本。

I am trying to delete text from a text field using monkeyrunner API . I am writing script in python.

有像KEY code_FORWARD_DEL,KEY code_DEL,并移动光标到最后KEY code_MOVE_END关键事件。

There are key events like " KEYCODE_FORWARD_DEL","KEYCODE_DEL" and to move the cursor to the end "KEYCODE_MOVE_END".

我想删除的文字,对于这一点,我试图将光标移动到结束,但KEY code_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.

然后,我试图用KEY code_FORWARD_DEL,但它也没有工作。

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?

推荐答案

这工作对我来说,虽然还没有试过设置Exchange帐户:

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)

这篇关于如何从文本字段使用删除文本monkeyrunner API(Python脚本)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆