Strange behaviour using "Key Sequence" or "Key Shortcut"

Experiences, small talk, and other automation gossip.
BCTest
Posts: 88
Joined: Tue Jun 03, 2014 10:15 am
Location: Hamburg, Germany

Strange behaviour using "Key Sequence" or "Key Shortcut"

Post by BCTest » Fri Jan 15, 2016 9:42 am

Hello,

I've noticed a strange behaviour regarding "Key Shortcut" and "Key Sequence": it seems to be that keystrokes would be send to the next dialog too.

First of all some information:
Our application needs a login at the start. The login can be confirmed by mouse (clicking OK-button) or by key (pressing Enter when focus is in password). After the login an info will be displayed which also can be confirmed by mouse or key. Now the main programme will be displayed.
We redirected the Enter-key to the Tab-Key so it is equal if you press Tab or Enter.

If you take a look on Difference between "Key Sequence" and "Key Shortcut"?: Now Key Shortcut also seems to send the keystroke to the next dialog.

Testing:
So I designed a simple test-app to reproduce this behaviour.
Both, Ranorex and I manually, executed the test successfully when we used the mouse for confirming the login. But when we used keystrokes Ranorex failed because the confirmation of the login by using the Enter-key also confirmed the following information. Looked strange for me.
After this I changed the keystroke from Enter to Tab so the focus in the information dialog was not on the OK-button, as it should be, the focus was on the Cancel-button like it would be if the Tab-Key was pressed in the information dialog.
Maybe I use the false technics?

Steps to reproduce:
I attached an archive including the Test-Programme and Ranorex-files. The test should be executed like this:
  • * Start Programme (located in the subfolder "Programm" in the archive)
    * Press "Enter" to set focus on password
    * Press "Enter" to confirm login
    * Press "Enter" to confirm information
    * Close application
In the recording "ConfirmLogin" I disabled two of the three alternatives, please enable only one of them to see the different behaviours. I hope somebody can reproduce this behaviour and send me a hint or solution.

We are using Ranorex 5.4.4 and Win7 SP1.

Regards,
Thomas.
Attachments
TestLogin.zip
Test-Programme and Ranorex-Solution
(2.81 MiB) Downloaded 60 times

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Strange behaviour using "Key Sequence" or "Key Shortcut"

Post by Support Team » Mon Jan 18, 2016 11:30 am

Hi Thomas,

I was able to reproduce the issue on my machine.

For the ‘Key Shortcut’ action, a repository item assignment is not required. Just replace the two ‘Key Shortcut’ actions in your ‘ConfirmLogin’ module by the same actions without assign them to a repository element (or assign the first ‘Key Shortcut’ to the repository element ‘Name’ and the second one to ‘Pass’). Now it works fine because the focus is chosen correctly.

I hope that helps.

Regards
Manuel
.
Image

BCTest
Posts: 88
Joined: Tue Jun 03, 2014 10:15 am
Location: Hamburg, Germany

Re: Strange behaviour using "Key Sequence" or "Key Shortcut"

Post by BCTest » Mon Jan 18, 2016 5:03 pm

Hi Support-Team,
Support Team - Manuel wrote: I hope that helps.
Absolutely!

The two solutions solved my problem.

Just two more questions:
  • * Sometimes pop-ups (like AV-Software) catch the focus while executing a test: Won't it be safer to send the keystroke to a repository element than to nothing to ensure the keystroke is sent to the SUT?
    * And why does this solution do not work for "Key Sequence"? Neither sending the key sequence "{return}" to nothing nor to the repository elements "name" and "pass" worked.
Regards,
Thomas

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Strange behaviour using "Key Sequence" or "Key Shortcut"

Post by Support Team » Tue Jan 19, 2016 1:33 pm

Hi Thomas,

Thank you for your feedback. I am happy to have helped you.

Concerning ‘keystroke safety’:
Definitely it is safer to assign all used actions in your action table to a specific repository element. Furthermore, the recording module is easier to read and therefore the maintenance will also be easier.

Concerning ‘Key Sequence’:
I reproduced the issue on my machine. It works fine, both without assign them to a repository element (please note: the focus must be on the field which should be filled) and with assign them to a specific repository element. The following screenshot shows a section of the recording module ‘ConfirmLogin’.
KeySequence.jpg
KeySequence.jpg (3.95 KiB) Viewed 1774 times
I hope this answers your questions.

Regards,
Manuel
.
Image