0

I am working on Appium Desktop(Version 1.6.2 (1.6.2)) Recently, I have updated "java_client-4.0.0" to "java_client-6.1.0" and I am facing several issue. One is that I am not able to enter Key Values in Capital case (i.e. "A"). As all the Key Stroke methods has been deprecated and the working one is "KeyEvent" which only take one parameter

Example Code:

Earlier:- driver.pressKeyCode(AndroidKeyCode.A, AndroidKeyMetastate.META_SHIFT_ON); **This line of code press letter "a" with Shift "on" i.e Capital letter "A"

Current:- driver.pressKey(new KeyEvent(AndroidKey.A)); **As "pressKeyCode" is deprecated, I used "pressKey" which only takes one parameter and I am not able to click "SHIFT"

Let me know if any more detail needed.

Ashish
  • 185
  • 1
  • 2
  • 17

2 Answers2

1

I suggest to refer latest appium java client tests for more usage of new methods

Here is the link

Ashish
  • 185
  • 1
  • 2
  • 17
Amit Jain
  • 4,389
  • 2
  • 18
  • 21
  • Thanks a lot @Amit They have, actually, changed use of "MetaModifier" in "pressKey" method. This is what is was searching for. Also. I have updated link(which was broken) – Ashish Aug 08 '18 at 08:49
  • Thanks Ashish for modifying url. – Amit Jain Aug 09 '18 at 12:59
0

Use following code:

driver.pressKey(new KeyEvent(AndroidKey.DEL));

Imports:

import io.appium.java_client.android.nativekey.AndroidKey;
import io.appium.java_client.android.nativekey.KeyEvent;
ShiyamTJ
  • 776
  • 8
  • 10