Search code examples
pythonappiumui-automationappium-android

How to type texts with Android Keyboard using Appium and Python?


I am trying to develop a script in Python 3.7 using Appium in which I want to enter any text in the text fields using the keyboard opened by the app. Is there any way to type the text using keyboard without using send_keys method in appium.

I am also not sure how send_keys works internally, whether it only works when the app keyboard is opened or its just simply enters the text without keyboard opened.

I would prefer to type the text, character by character, using the keyboard of the smartphone.


Solution

  • Actually, this is not a good idea because there is no way to touching keyboard keys as an element. I mean the appium cannot see the keyboard as elements. Also, you will need this if you only want to test the functionality of the keyboard itself. Otherwise technically element.send_keys() acts the same with no difference on std-out. Also, element.set_text() act the paste if you want. Anyway, to reach this you should:

    1- Open the keyboard by clicking on the input field

    2- Find the coordinates of the keys and store them in a variable.

    3- Touch the coordinates directly.