Use the keyboard keys while automating Android apps
- At the top of your test script, add the following script to import the following libraries:
import com.kms.katalon.core.mobile.keyword.internal.MobileDriverFactory
import io.appium.java_client.android.AndroidDriver
import io.appium.java_client.android.nativekey.AndroidKey
import io.appium.java_client.android.nativekey.KeyEvent - Use this code to access the keys.
AndroidKey
is an enum with key entries likeAndroidKey.ENTER
andAndroidKey.A
. For example:AndroidDriver<?> driver = MobileDriverFactory.getDriver()
driver.pressKey(new KeyEvent(AndroidKey.ENTER))For a complete list of keys, refer to the java-client 6.1.0 API documentation: Enum AndroidKey.