Problems with AndroidKeyCode deprecated (this code was working well few days ago)
import io.appium.java_client.android.AndroidDriver as AndroidDriver
import io.appium.java_client.AppiumDriver as AppiumDriver
import io.appium.java_client.android.AndroidDriver as AndroidDriver
import io.appium.java_client.android.AndroidKeyCode as AndroidKeyCode
Mobile.comment(‘PIN SETUP’)
//Tap the object to get the keyboard activated
Mobile.tap(findTestObject(‘PIN/Pin_1’), 0) //tap the object in order to activate the keyboard
AndroidDriver<?> driver = MobileDriverFactory.getDriver()
driver.pressKeyCode(AndroidKeyCode.ENTER)
driver.pressKeyCode(AndroidKeyCode.KEYCODE_1)
driver.pressKeyCode(AndroidKeyCode.KEYCODE_2)
driver.pressKeyCode(AndroidKeyCode.KEYCODE_3)
driver.pressKeyCode(AndroidKeyCode.KEYCODE_4)
I replaced by the method Androidkey and i still have problems
Can someone help me to implement the libraries
import io.appium.java_client.android.nativekey.keyEvent
import io.appium.java_client.android.nativekey.AndroidKey
What I tried to implement was:
import com.kms.katalon.core.mobile.keyword.internal.MobileDriverFactory as MobileDriverFactory
import io.appium.java_client.AppiumDriver as AppiumDriver
import io.appium.java_client.android.AndroidDriver as AndroidDriver
import io.appium.java_client.android.nativekey.keyEvent
import io.appium.java_client.android.nativekey.AndroidKey
Mobile.comment(‘PIN SETUP’)
//Tap the object to get the keyboard activated
Mobile.tap(findTestObject(‘PIN/Pin_1’), 0)
AndroidDriver<?> driver = MobileDriverFactory.getDriver()
driver.pressKey(new keyEvent(AndroidKey.ENTER))
driver.pressKey(new keyEvent(AndroidKey.DIGIT_1))
driver.pressKey(new keyEvent(AndroidKey.DIGIT_2))
driver.pressKey(new keyEvent(AndroidKey.DIGIT_3))
driver.pressKey(new keyEvent(AndroidKey.DIGIT_4))
and the error i had was “…Pin/Script1569454645784.groovy: 18: unable to resolve class io.appium.java_client.android.nativekey.keyEvent
@ line 18, column 1.
import io.appium.java_client.android.nativekey.keyEvent”
and still not working, please help