New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to tap search button in Android App keyboard using automation #5162
Comments
Can you send |
@imurchie I have tried 66, but its doesn't work for me. |
Ok. Can you give us the Appium server logs? So we can see what, if anything, is going on? |
@imurchie => 0x00000054 driver.sendKeyEvent(0x00000054); Appium logs:- info: --> POST /wd/hub/session/b4bc70c1-bcb8-4bc1-8f3f-41dd953b844d/element/3/value {"id":"3","value":["Mumbai"]} => 66 driver.sendKeyEvent(66); Appium logs:- info: <-- POST /wd/hub/session/dee8cd13-e647-4300-8498-f5dc2bf1c7d1/element 200 42.612 ms - 87 {"status":0,"value":{"ELEMENT":"3"},"sessionId":"dee8cd13-e647-4300-8498-f5dc2bf1c7d1"} |
Ok. The keyevent is getting through in both cases. I guess it's just a matter of finding the correct key event. Without the app, it is hard to say from here. |
Any progress? |
Is this keyboard different? |
Hi, We are facing the same issue automating testing on our app using appium. The logs for the keyEvents 84 and 66 are similar to the outputs listed in the above comments. Here is what we have listed for Any help related to this would be extremely useful. Thanks in advance! |
I'm also facing this issue. But I was debugging the code written by the developer which looks like as follows:
It never hit the KeyEvent.KEYCODE_ENTER, rather it hits EditorInfo.IME_ACTION_SEARCH. Hence the actionId is always 3. This is why we are not able to listen to the KEYCODE_ENTER which is 66. We should have some listener to the EditorInfo actions. |
@email2vimalraj are you able to perform EditorInfo. IME_Actions ? Our developers using IME_ACTION_SEND which has constant value 4. When trying to perform this action with appium keypress its performing BACK.
has anyone found a way to perform EditorInfo IME actions using appium ? |
If you wanna perform Search on the Native Search App then you can use - AndroidKeyCode But I'm still trying to find out how to actually Tap on the Android Keyboard Search Icon |
Hi guys, I'm facing the same problem. Sending a "UiDevice.getInstance(getInstrumentation()).pressSearch()" or "UiDevice.getInstance(getInstrumentation()).pressKeyCode(KeyEvent.KEYCODE_SEARCH)", nothing happens :-( But, when a send a "UiDevice.getInstance(getInstrumentation()).pressEnter()", the actionId sent in onEditorAction(int actionId) method is 0 (zero). For now, this was the only way I could do to get my EditText "onEditorAction" method fired. Any solution for this case ?? |
@magnumrocha those don't look like Appium commands, they look like UiAutomator commands. In any case without the app or a recent set of Appium logs run on Appium's UiAutomator2 backend, this will be impossible to track down. Closing for now. |
This commands solves my problem |
@mykola-mokhnach thanks , its working for me |
This solution worked for me in JavaScript:
This allowed me to find a text field, input some text, and submit a search command (same as clicking the search icon in the keyboard). Of course, you have to replace |
Try below java script code. action: The name or an integer code of the editor action to be executed. The following action names are supported: normal, unspecified, none, go, search, send, next, done, previous |
Thanks, @ChandraSharma0377 , This javascript code worked for me as well. |
@ChandraSharma0377 @RRohitmehta does the javascript code works with Action Class ? |
This worked Thanks @ChandraSharma0377 |
@jlipps @imurchie
Steps:-
Code to tap on search button:-
Method1:-
driver.sendKeyEvent(0x00000054);
Where 0x00000054 is KEYCODE_SEARCH. Refer http://developer.android.com/reference/android/view/KeyEvent.html
Method2:-
driver.sendKeyEvent(84). where 84 is constant value for search.
Refer:-
public static final int KEYCODE_SEARCH
Added in API level 1
Key code constant: Search key.
Constant Value: 84 (0x00000054)
What keycode I have to pass to make it work?
Kindly help me.
The text was updated successfully, but these errors were encountered: