Sending enter/return key to text box on Android

Mobile Testing, Android App Testing.
jackson.delahunt
Posts: 19
Joined: Wed Sep 18, 2013 9:01 am

Sending enter/return key to text box on Android

Post by jackson.delahunt » Wed Sep 18, 2013 9:08 am

Hi,

I have a log in screen with two text boxes for the username and password. There is no log in button. The user must press enter/return in the password box for the form to be submitted. When performing the steps on the device and recording the actions through ranorex, the text gets recorded correctly, but the enter keypress in the password box that submits the form does not get recorded, and hence the successful login verification check fails, as the login wasn't completed. How do I send an enter keypress via an automated test?

Thanks for your help!

krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Sending enter/return key to text box on Android

Post by krstcs » Wed Sep 18, 2013 1:51 pm

You probably are sending the enter in the same Key Sequence action as your text input. Try using a separate action, and specifically a Key Shortcut, using the ENTER key on the password field.

If that doesn't work you will probably need to talk to your developers about a different UI paradigm. Normally you do not want to hide user actions from the user, especially when those actions are required in order to continue the business process. I don't know your UI, but I would recommend having an actual SUBMIT button added that accepts an ENTER or a mouse click, thus making it obvious to the user what they need to do, and making the test case easier to automate.
Shortcuts usually aren't...

jackson.delahunt
Posts: 19
Joined: Wed Sep 18, 2013 9:01 am

Re: Sending enter/return key to text box on Android

Post by jackson.delahunt » Wed Sep 18, 2013 2:18 pm

Is "{enter}" the correct way to send an enter? If I press enter in the input steps, it commits the field.

As for the design approach, I appreciate where you're coming from, but unfortunately I have no control over the design!

krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Sending enter/return key to text box on Android

Post by krstcs » Wed Sep 18, 2013 2:46 pm

If you are using Ranorex Studio, add a new Key Shortcut action. Click the "..." button next to the parameter and hit the "ENTER" key. Then, CLICK the "OK" button. That will setup your shortcut.

NOTE: You have to click the OK or CANCEL button on this little dialog, so make sure you don't just hit ENTER to try to accept it. It won't work and ENTER will be set as the shortcut. Ask me how I know that... :D

As for design, while I do realize that often we don't have direct input to the process, part of QA is to look at design and make sure it meets stake-holder expectations. It might amaze you how much control you actually have when you phrase it correctly, and have data to back it up, like say, not being able to automate it (if this approach doesn't work), thus costing more money/time to test. :D

One other thing that you might do is ask the devs about the events that are being fired and how they are triggered. This may give you some insight into what you can do to get around this. They might actually have a hidden button behind the input field for example.

But, yeah, I do understand! Good luck!
Shortcuts usually aren't...

jackson.delahunt
Posts: 19
Joined: Wed Sep 18, 2013 9:01 am

Re: Sending enter/return key to text box on Android

Post by jackson.delahunt » Thu Sep 19, 2013 12:08 am

I just found that there is a special Action called a 'Mobile Key Press' which has the {ENTER} parameter. Phew!

Wow, thank you so much for the wise advice in regards to design. I had never considered that I may have an ability to influence the design, and that my input could actually improve the product's functionality as well as reduce the project's cost. This level of support is far beyond expectation, it's career guidance! I'm so grateful - thank you!

Right, not being a dev I this approach hadn't occurred to me. There is often another way, and this might be the case for future issues I run into. I'll bear it in mind when encountering future problems :)

krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Sending enter/return key to text box on Android

Post by krstcs » Thu Sep 19, 2013 1:25 pm

Great! Yeah, I haven't gotten into the mobile stuff (yet!) so I had forgotten about mobile. It didn't even dawn on me that we were in the mobile forum until you said that. :D


It took me many years of banging my head against that wall before I realized I could take this route, too. :D And I'm a developer...

BTW, I'm not a Ranorex employee, just another user like you. These guys are great though, they listen more than just about any other software house I have worked with.
Shortcuts usually aren't...