I’m doing some automated tests on Android using appium (chrome browser) and i’ve encounter an issue while sending keys to a text box.
Sometimes the string is inputted to the box in a mixed order, for example: test@some,domain.com --> test@some,domain.moc
Did anyone saw this behavior?
My environment is:
Appium 1.3.7
Mac OS X 10.10.2
Thanks in advance!!
I haven’t encountered it lately.
We solved it by adding a check after the send keys and resend them if there was an error.
We are now using the latest release of appium but the android version is 5.1.1.
Thanks for your reply, I used Android 5.0 and installed a google input method , still got same issue…I also tried adb shell input, some times, still got wrong order…
, btw, how do you check if the send key is correct, use findelement, then gettext something like that?..
for ios we have a capability to delay input of keys:
String INTER_KEY_DELAY = "interKeyDelay";
But there is no capability similar for android.
I guess you can try to do a method. I tried with delay above 250ms and it works properly. If I give less delay, some keys will be written before others
public void mySendText(String text, int delay) throws IOException, InterruptedException {
String ADB_SEND_TEXT = "adb shell input text %s";
for (char ch: text.toCharArray()) {
Runtime.getRuntime().exec((String.format(ADB_SEND_TEXT,ch)));
Thread.sleep(delay);
}
}
Hi fionazj,
Does this method , which is mentioned by Cardoso, works for you on Android platform? As I am also facing the same issue with Android version 6.
I also facing same issue for sendkeys for Android OS version 7.0 and above.
Sendkeys() method is stop support for OTP text field.
I have used following solution: