[Android] -Tapping Done key of the android keypad

6,289 views
Skip to first unread message

nishant shah

unread,
Oct 7, 2013, 1:26:08 PM10/7/13
to appium-...@googlegroups.com
Hi Friends,
 
I tried searching a lot for a way to hit the Done key of the Android keypad, but was not successful in all the solutions provided in the other posts
I tried using driver.sendkeys(Keys.Return) thinking that enter may hit the Done key but it didn't
Can anyone help me out with this. I know the only way is using javascript
But, can anyone provide me with the java script for the same.
 
Thanks in advance

nishant shah

unread,
Oct 7, 2013, 2:55:36 PM10/7/13
to appium-...@googlegroups.com
Hi Team,
Only this particular step is remaining to be automated in my app. But, its a crucial part of my app and need to automate it anyhow.
So, any sort of quick help would be highly appreciated
 
Thanks,
Nishant


--
http://appium.io
---
You received this message because you are subscribed to a topic in the Google Groups "Appium-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/appium-discuss/FVKlhGdCGbQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to appium-discus...@googlegroups.com.
Visit this group at http://groups.google.com/group/appium-discuss.
For more options, visit https://groups.google.com/groups/opt_out.

Jonathan Lipps

unread,
Oct 7, 2013, 2:58:33 PM10/7/13
to nishant shah, appium-...@googlegroups.com
what about hitting that part of the screen as a workaround?

You received this message because you are subscribed to the Google Groups "Appium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to appium-discus...@googlegroups.com.

Jonathan Lipps

unread,
Oct 7, 2013, 3:08:18 PM10/7/13
to nishant shah, appium-...@googlegroups.com
There's probably a keyevent you can use.


keycode 66.

so you could do mobile: keyevent, {keycode: 66}

On Oct 7, 2013, at 12:02 PM, nishant shah <nishan...@gmail.com> wrote:

Thanks for the response Jonathan
I wont mind that. But not sure whether My manager will have the same thoughts :)
He wants the scripts to be robust
 
I think this will fail even if the screen size changes by a small extent
Isnt this possible by any other means? like javascript etc?
 
Thanks,
Nishant

Jonathan Lipps

unread,
Oct 8, 2013, 12:25:23 PM10/8/13
to nishant shah, appium-...@googlegroups.com
you probably just want to go through the list of keycodes until you find the one that does what you want

On Oct 7, 2013, at 11:56 PM, nishant shah <nishan...@gmail.com> wrote:

Hi,
The key event did work, but Pressing Enter didn't press the Done key of the keypad :(
Any idea if I can change the type of keypad to display enter instead of done?
 
Thanks,
Nishant

nishant shah

unread,
Oct 8, 2013, 12:45:16 PM10/8/13
to Jonathan Lipps, appium-...@googlegroups.com

Hi jonathan,
Thanks for the response.
Actually I tried all the possible key events but didnt find a suitable one dat wud press done key for me
The enter key, I.e 66 also didnt solve d purpose
Finally I used ur first suggestion of using coordinates
Hoping to see appium providing this support soon for android as well..otherwise looks a promising tool
Thanks,
Nishant

Jonathan Lipps

unread,
Oct 8, 2013, 12:47:01 PM10/8/13
to nishant shah, appium-...@googlegroups.com
when google provides a way to get access to keyboard buttons, we'll certainly support it.

nishant shah

unread,
Oct 8, 2013, 12:59:45 PM10/8/13
to Jonathan Lipps, appium-...@googlegroups.com
I guess other tools like calabash, robotium do have this feature. I havent tried it personally but have heard it from my colleagues. So, google might have already provided it

bootstrap online

unread,
Oct 8, 2013, 1:28:47 PM10/8/13
to nishant shah, Jonathan Lipps, appium-...@googlegroups.com
If it works with calabash, then selendroid can do it also. I'd be
surprised if uiautomator doesn't have a way to send this keycode.

nishant shah

unread,
Oct 8, 2013, 1:46:45 PM10/8/13
to bootstrap online, Jonathan Lipps, appium-...@googlegroups.com
Hey Matt,
Yes you are right. I also thought the same
But, didn't get an appropriate key for Done
However, now I agree with the fact that Google doesn't provide a way for accessing the keys
It's only through this native events that its possible

Hope google provides it soon then :)

Bdw, For IOS its perfectly working fine..all the keys are been identified by the Name

Thanks,
Nishant

bootstrap online

unread,
Oct 8, 2013, 1:50:42 PM10/8/13
to nishant shah, Jonathan Lipps, appium-...@googlegroups.com
You'd probably have to patch Selendroid. Google will be releasing
Espresso soon which will be a nice replacement.
http://googletesting.blogspot.com/2013/08/how-google-team-tests-mobile-apps.html

nishant shah

unread,
Oct 8, 2013, 2:11:12 PM10/8/13
to bootstrap online, Jonathan Lipps, appium-...@googlegroups.com
Looks promising, thanks for sharing it
You said will be a nice replacement. Does this mean replacement for Appium?
or for the scenario that I am trying to automate ?

Please clarify because we are about to finalize on Appium for automating our Regression pack and the project will be kicked off soon

Thanks,
Nishant

bootstrap online

unread,
Oct 8, 2013, 2:15:28 PM10/8/13
to nishant shah, Jonathan Lipps, appium-...@googlegroups.com
I will be writing an Espresso mode for Appium when Google releases it.
http://sauceio.com/index.php/2013/07/guest-post-mobile-testing-the-google-way-with-appium-sauce-labs/

Instead of using Appium in Selendroid mode, you'll be able to select
Espresso mode.

nishant shah

unread,
Oct 8, 2013, 2:24:33 PM10/8/13
to bootstrap online, Jonathan Lipps, appium-...@googlegroups.com
Okay, that sounds really cool
Thanks for clarifying

Cheers,
Nishant

nishant shah

unread,
Feb 19, 2014, 2:10:34 PM2/19/14
to appium-...@googlegroups.com
Hi,
I haven't yet been able to figure out a solution for this problem
Its really really weird that driver.sendKeys(Keys.Return) is able to tap on the Next key
But the same thing fails to work when the Next key is replaced by Done key

Please need some urgent solution on this. A solution better than hitting the Done key on the basis of co-ordinates

Thanks,
Nishant

Jonathan Lipps

unread,
Feb 19, 2014, 4:00:57 PM2/19/14
to nishant shah, appium-...@googlegroups.com
Just find the "Next" key and click it, I think that's possible.

Pooja Shah

unread,
Mar 6, 2014, 1:43:47 AM3/6/14
to appium-...@googlegroups.com
Hi Nishant,

While doing "driver.sendKeys(Keys.Return)" , isn't there a need to find any element on keypad?
sendKeys function can be applied only on element not on driver object.

Basically, I also want to do some key events on keypad like (back, sign of back, return, next, done etc.)
Back button works with -> driver.navigate.back();

But for other events, I need a workaround......  (Jonathan had suggested to fire a script with keyecode ex. driver.execute_script("mobile: keyevent", [{"keycode": 82}]), but in java it gives syntax error--> syntax error on tokens, Expression expected instead, looks like it is asking for passing a hashmap instead of an array like this works in Java-->
((JavascriptExecutor) context.getWebDriver()).executeScript("mobile: tap", new HashMap<String, Double>() {{ put("tapCount",(double) 1); put("touchCount",(double)1); put("duration", 0.5); put("x", (double) 241); put("y", (double) 565); }});

Also, How can I recognize whether the keypad is visible/present then fire key (back/next/done etc.), else skip sending any key. Like we can do with any element if displayed or found perform some action else just skip.

I'm using webdriver+java+appium16

Thanks,
Pooja

Pooja Shah

unread,
Mar 6, 2014, 2:02:02 AM3/6/14
to appium-...@googlegroups.com
One update:

Jonathan: passing keycode works with Hashmap (instead of array, just a trail, and it worked)  in Java
((JavascriptExecutor) driver).executeScript("mobile: keyevent",  new HashMap<String, Double>() {{ put("keycode",(double) 82);}});
So one can use any of the keys to fire desired event (http://stackoverflow.com/questions/7789826/adb-shell-input-events)

However, still I'm looking for a way where I can identify whether the keyPad/keyboard exists or not so accordingly actions can be performed.
Please let me know, if there is any straight forward way.

Thanks,
Pooja

Naveen Kumar

unread,
Jun 11, 2014, 11:51:21 AM6/11/14
to appium-...@googlegroups.com
Hi Pooja,

What will it be in C# code?


On Thursday, 6 March 2014 12:13:47 UTC+5:30, Pooja Shah wrote:

appium.te...@gmail.com

unread,
Jul 9, 2014, 10:06:44 AM7/9/14
to appium-...@googlegroups.com
Hey, any update on this please?
I'm trying to press Search button on Android onscreen keyboard - > keyevent 84 not working (Ruby)$driver.key_event(84)
The Android onscreen keyboard is not displayed, I did not find any method to display it (How did you try to display the Android keyboard and to get button''s coordinates please?)
I failed with these methods:

Best regards!

Naveen Kumar

unread,
Jul 9, 2014, 10:15:24 AM7/9/14
to appium.te...@gmail.com, appium-...@googlegroups.com

Hi Laura,

If you are automating any app(nowt mobile browser) on android key 66 should work.
Suppose there is a search textbox with no search button in the app., and search happens when you write in text box and press enter. In this case when you are typing the keyboard should appear. So write the text using  the sendkeys() function of WebDriver and send the adb key 66 to perform enter.

Regards,
Naveen Kumar

--
http://appium.io
---
You received this message because you are subscribed to a topic in the Google Groups "Appium-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/appium-discuss/FVKlhGdCGbQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to appium-discus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

appium.te...@gmail.com

unread,
Jul 9, 2014, 10:43:20 AM7/9/14
to appium-...@googlegroups.com, appium.te...@gmail.com
Hello!
Unfortunately nothing happens upon sending key_event 66 (Ruby)

textfield(1).send_keys(myVariable) --> This works but the Android keyboard is not displayed while sending text in textfield neither is the Search button
$driver.key_event(66) -> Not working, neither 84/Search or 125 The search is not sent

How do you get the Android keyboard displayed?

Thanks!

Chandra Reddy Gaddam

unread,
Jul 29, 2014, 11:45:52 AM7/29/14
to appium-...@googlegroups.com
hello,

You can try this code...its working for me

    JavascriptExecutor search = (JavascriptExecutor) driver;
        HashMap<String, Double> sObject = new HashMap<String, Double>();
        sObject.put("tapCount",(double) 1);
        sObject.put("touchCount",(double)1);
        sObject.put("duration", 0.5);
        sObject.put("x", (double) 995);
        sObject.put("y", (double) 1819);
        search.executeScript("mobile: tap", sObject);

i am automating android real device using Appium

Thanks,
Chandra

Jonah Stiennon

unread,
Jul 29, 2014, 1:07:44 PM7/29/14
to appium-...@googlegroups.com
I thought we removed the `mobile: tap` command. You should be using the TouchAction api instead.

driver.tap(1, 995, 1819, 0.5)

Reply all
Reply to author
Forward
0 new messages