I have a username textfield on an Android app. If a user long-presses on the textfield, a menu pops up. If a user lightly taps inside the textfield, then the user can enter the username.
If I use sendKeys, it somehow is interpreted as long-press which I do NOT want. How do I avoid triggering long-pressing from sendKeys?
Just perform click on before you enter sendKeys in Text Field.
element.click();
element.clear(); //(This statement is not mandatory)
element.sendKeys(“text”);
emailField.click();
Process p = Runtime.getRuntime().exec("/Users/username/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell input text [email protected]");
Hope this helps if anyone else is having the same issue…
We ran into a similar issue with one of the PID (passcode) fields in our mobile app and we were able to sort that with a click and using the pressKeyCode method… Hope it helps others too