2

I'm using android version 4.4.2 and python 2.7 for UI automation.

when I tried to capture view using UI automator/culebra/dump, I'm not able to capture QWERTY keypad view. Please help me on this

I need to touch and type on qwerty keypad and I should be able to type alpha-numeric text and smileys. Also once typed, you should verify if what is displayed on the screen is what you intended to type.

Thanks in advance.

4 Answers4

0

QWERTY keyboard is webview and UiAutomator does not support webview at present. AndroidViewClient is based on UiAutomator and therefore does not capture the keyboard.

If your objective is to just type the text, you can first detect if the focus is on the text field and then use device.type('your_text').

user846316
  • 6,037
  • 6
  • 31
  • 40
0

As another answer mentions, AndroidViewClient using UiAutomator back-end cannot dump the content of any other than the main window, thus why the Input Method window is not accessible.

AndroidViewClient supports other back-ends, like ViewServer. You can take a look at the examples provided with AndroidViewClient source, particularly at dump-all-windows.py, which shows how to dump the content of other windows not just the main one. Even though you can get most of the Views in the keyboard, the actual keys are handled internally by com.android.inputmethod.keyboard.internal.PreviewPlacerView and thus you won't be able to interact with them individually.

Remember that you can always touch the keys using their coordinates like in

  if device.isKeyboardShown():
    device.touch(400, 950)

that would touch the G on a 768x1280 emulator. But this is device dependent.

Diego Torres Milano
  • 65,697
  • 9
  • 111
  • 134
0

If you intend to press character from the keyboard, use:

getDevice().pressKeyCode(KeyEvent.<KeyCode>)

KeyCode can be obtained from: http://developer.android.com/reference/android/view/KeyEvent.html but before doing this you need to convert your string into character and pass each character to get the KeyEventCode for that.

Amit Kumar
  • 67
  • 3
0
can perform:
typeInDevice("Any text")
or
typeInView("ViewId/content/text where you want to enter text","Any text")

device accessibility can be as your requirement .. 
self.typeInDevice()
or 
vc.typeInDevice()

Verification :
isKeyboardShown(): can be used for verifying that the keyboard 
is appeared.
the entered text can be retrieved by using gettext() and same can be 
compared with the entered value.
Sanyal
  • 864
  • 10
  • 22