How to Enter Capital Letter on Mobile

Platform : Mac
Katalon Version 7.1.2
Device : Real Device Android 8.0

Hi. I’m trying to press shift button on android keyboard together with a letter.

This is my code looks like

Mobile.tap(findTestObject(‘Android/txtboxUserOppo’), 0)

AppiumDriver<?> driver = MobileDriverFactory.getDriver()

driver.longPressKeyCode(60)

driver.pressKeyCode(AndroidKeyCode.KEYCODE_A)

driver.pressKeyCode(AndroidKeyCode.KEYCODE_B)

I’ve tried using PressKeyCode and longPressKeyCode. Also tried pressing KEYCODE_CAPS_LOCK, and KEYCODE_SHIFT_RIGHT to no avail

what came out was “ab” without capital A

Is there any other alternative to write capital letter ?

This is the keyboard screen.
image

Thanks

Hi @billy.budiharto,

driver.pressKeyCode has a secondary parameter that you can use to add the shift modifier, which should look something like:

driver.pressKeyCode(AndroidKeyCode.KEYCODE_A, AndroidKeyCode.META_SHIFT_ON)

As a sidenote, driver.pressKeyCode is deprecated and the new function you can use is driver.pressKey with a KeyEvent as the parameter. You can see more info about it here:

Hope this helps,

Chris