Usage of keyboard in mobile testing

Hi @rkarim,

Assuming that the Done button will always be in the lower right of the screen, you could find the height and width of the screen and then use that to calculate an approximate location of the button:

def height = Mobile.getDeviceHeight()
def width = Mobile.getDeviceWidth()
def buttonX = height - 30 // this is a guess and assumes that x=0 is at the left of the screen - needs to be played with
def buttonY = width - 30 // this is a guess and assumes that y=0 is at the top of the screen - needs to be played with
Mobile.tapAtPosition(buttonX, buttonY)

Hope this helps,

Chris

Unable to use the android key code. As I searched in website, it has mentioned that Android keycode deprecated. Please provide the solution for this.

Hi @mchidambarakumar,

It looks like the replacement for AndroidKeyCode is AndroidKey:

https://appium.github.io/java-client/io/appium/java_client/android/nativekey/AndroidKey.html

You should be able to use AndroidKey.ENTER as the enter key.

Hope this helps,

Chris

Thanks it worked in me.

1 Like

Thanks, this work on my case.

Hi, I have a similar issue!
Problem:
when I enter the phone number using send keys, then the “SEND OTP” button is not active to press.
Expected Result:
when a user will enter the phone number using a keyboard, then the “SEND OTP” button should be active to press.

@Zarashima @Chris_Trevarthen anyone please guide me