How to access the Context Menu using keyboard

333 views
Skip to first unread message

kulm...@gmail.com

unread,
Aug 22, 2013, 10:49:39 PM8/22/13
to teststa...@googlegroups.com
I need to use context menu key (the menu that comes with right-click) and then 2 keys to select items from the context menu.
 
1. I didn't find the context menu key in the SpecialKeys Enum.
2. I figured Shift+F10 gives the same effect. So I wrote following code.
 
            AttachedKeyboard keyboard = designerSurface.Keyboard;
            keyboard.HoldKey(KeyboardInput.SpecialKeys.SHIFT);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.F10);
            keyboard.LeaveKey(KeyboardInput.SpecialKeys.SHIFT);
            keyboard.Enter("d");
            keyboard.Enter("e");
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.RETURN);
 
3. I also tried putting some Sleeps in between.
 
           AttachedKeyboard keyboard = designerSurface.Keyboard;
            keyboard.HoldKey(KeyboardInput.SpecialKeys.SHIFT);
            System.Threading.Thread.Sleep(1000);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.F10);
            System.Threading.Thread.Sleep(1000);
            keyboard.LeaveKey(KeyboardInput.SpecialKeys.SHIFT);
            System.Threading.Thread.Sleep(1000);
            keyboard.Enter("d");
            System.Threading.Thread.Sleep(1000);
            keyboard.Enter("e");
            System.Threading.Thread.Sleep(1000);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.RETURN);
 
The context menu just flickers for a fraction of a sec and then disappears. The 2 keys to select item from the menu never work. Anyone has any clue why?
 
Thanks!  

Jake Ginnivan

unread,
Aug 23, 2013, 1:55:21 AM8/23/13
to kulm...@gmail.com, teststa...@googlegroups.com
Can you use right click on the mouse instead?

Sent from my Windows Phone

From: kulm...@gmail.com
Sent: ‎23/‎08/‎2013 03:49
To: teststa...@googlegroups.com
Subject: How to access the Context Menu using keyboard

--
You received this message because you are subscribed to the Google Groups "TestStack.White" group.
To unsubscribe from this group and stop receiving emails from it, send an email to teststack_whi...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Mugdha Kulkarni

unread,
Aug 23, 2013, 4:36:13 AM8/23/13
to Jake Ginnivan, teststa...@googlegroups.com
Unfortunately that's exactly what I am trying to avoid for a reason. :(

From: Jake Ginnivan
Sent: ‎8/‎22/‎2013 10:55 PM
To: kulm...@gmail.com; teststa...@googlegroups.com
Subject: RE: How to access the Context Menu using keyboard

Jake Ginnivan

unread,
Aug 24, 2013, 10:43:59 AM8/24/13
to Mugdha Kulkarni, teststa...@googlegroups.com

Do you think you could extend https://github.com/TestStack/White/blob/master/src/TestStack.White.UITests/ControlTests/MenuItems/PopUpMenuTest.cs with a failing test case which demonstrates what you are trying to achieve. This sounds like an issue, and I do not have the time to replicate and also fix the issue at the moment.

 

Cheers,

Jake

 

From: teststa...@googlegroups.com [mailto:teststa...@googlegroups.com] On Behalf Of Mugdha Kulkarni
Sent: Friday, 23 August 2013 9:36 AM
To: Jake Ginnivan; teststa...@googlegroups.com
Subject: RE: How to access the Context Menu using keyboard

 

Unfortunately that's exactly what I am trying to avoid for a reason. :(

Mugdha Kulkarni

unread,
Aug 24, 2013, 4:35:24 PM8/24/13
to Jake Ginnivan, teststa...@googlegroups.com
Let me have a look. I sure can extend if it's easy enough.

From: Jake Ginnivan
Sent: ‎8/‎24/‎2013 7:44 AM
To: Mugdha Kulkarni; teststa...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages