Alt button accesses File menu in the application

Ask general questions here.
phaneendra
Posts: 7
Joined: Tue Sep 13, 2016 1:38 pm

Alt button accesses File menu in the application

Post by phaneendra » Tue Sep 13, 2016 1:51 pm

Hi Team,

When I use: Keyboard.Press(Keys.LMenu) /* alt key */ it tries to access the File menu of the application.

Please let me know what can be done for this?

Br,
Phanee

asdf
Posts: 174
Joined: Mon Mar 21, 2016 3:16 pm

Re: Alt button accesses File menu in the application

Post by asdf » Thu Sep 15, 2016 3:54 pm

Hi Phaneendra,

Unfortunately, I'm not exactly sure what you're trying to achieve.
Could you please give us a bit more information about your issue?

Best regards,
asdf

phaneendra
Posts: 7
Joined: Tue Sep 13, 2016 1:38 pm

Re: Alt button accesses File menu in the application

Post by phaneendra » Fri Sep 16, 2016 5:39 am

Hi,

We have a WPF application with graphical interface.

In the graphical interface, when I switch between different commands, we use the windows ALT key functionality to switch between scenarios.

I am trying to automate the functionality with ranorex. And, in the code to do this process, I have used:

Keyboard.Press(Keys.LMenu) to achieve this behavior.

But, when I do this, the automation process access the 'File' menu of the WPF application.

I am unable to solve what's going wrong.

Br,
Phaneendra.

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

Re: Alt button accesses File menu in the application

Post by krstcs » Fri Sep 16, 2016 1:24 pm

This is the expected behavior from Windows applications. If you press and release the ALT key, the focused application's main menu will be opened. This is Windows OS functionality, not Ranorex.
Shortcuts usually aren't...

phaneendra
Posts: 7
Joined: Tue Sep 13, 2016 1:38 pm

Re: Alt button accesses File menu in the application

Post by phaneendra » Mon Sep 19, 2016 7:57 am

Thanks,

yes, I understand it's the default windows behavior.

But, If I use the similar steps with the instant recording from ranorex studio, the above problem doesn't appear.

If I use this code sample in my project, the problem occurs.

I am keen to know, if the ranorex studio uses some settings to suppress these default windows actions.

Best regards,
Phanee.

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

Re: Alt button accesses File menu in the application

Post by krstcs » Mon Sep 19, 2016 1:40 pm

Ranorex does not do anything to the default Windows settings unless you specifically direct it to.

In your case, I would right-click the working version's action and select "View Code". This will show you what the actual code-behind looks like so you can get an idea of how Ranorex is using the method call.
Shortcuts usually aren't...

phaneendra
Posts: 7
Joined: Tue Sep 13, 2016 1:38 pm

Re: Alt button accesses File menu in the application

Post by phaneendra » Mon Sep 19, 2016 1:44 pm

Yes, I did the similar way how you've suggested (copying the text displayed under code-behind), but it doesn't help.

I am not sure how can I solve this. But, I see something ranorex does with the delays.

infact, If I add more delays, it works perfect.

Br,
Phanee.

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

Re: Alt button accesses File menu in the application

Post by krstcs » Mon Sep 19, 2016 1:47 pm

Ah, yeah, timing issues are probably 75%, or more, of the problems in getting test automation to work right.
Shortcuts usually aren't...

phaneendra
Posts: 7
Joined: Tue Sep 13, 2016 1:38 pm

Re: Alt button accesses File menu in the application

Post by phaneendra » Mon Sep 19, 2016 2:04 pm

Hmm, we should try to normalize these with some delays(hopefully a trail & error method).

Br,
Phanee