Forum Discussion

varghesejim's avatar
varghesejim
Occasional Contributor
11 years ago

Arrow keys for Menu selection not working properly

Hi,



The following way of navigation is not working as expected(Wpf application)



Aliases.SomeApp.XamMenuItem.Keys("[Down]");

Aliases.App_Shell.HwndSource_MainWindow.Keys("[Right]");

Aliases.App_Shell.HwndSource_MainWindow.Keys("[Enter]");



...................



Aliases.SomeApp.XamMenuItem.Keys("[Down]");

Aliases.App_Shell.HwndSource_MainWindow.Keys("[Right]");

Aliases.SomeApp.XamMenuItem.Keys("[Down]");

Aliases.SomeApp.XamMenuItem.Keys("[Down]");

Aliases.App_Shell.HwndSource_MainWindow.Keys("[Enter]");



Because of some reason it only works sometimes. How can we make sure the key inputs fpr menu selections are working consistently?
  • Are you giving the menu items enough time to render?  I don't see any rendering Delays or Waits in your examples.  TC can easily press keys faster than menu items can render.
  • Hi Jimmy,

     


    Could you please describe the difference between the expected and actual behavior?


    It looks like you are testing Infragistics' XamMenu control. It makes sense trying to navigate through menu items via native methods and controls. Have your tried this approach?


     

  • karkadil's avatar
    karkadil
    Valued Contributor
    Hi,



    In addition to Tanya's suggestion I want to add, that if you want to work with menu items using keyboard shortcuts, you have to send keys to the application main window, not the menu itself.
  • varghesejim's avatar
    varghesejim
    Occasional Contributor
    Tanya, I am not testing the menu itself, but clicking the menu opens up a report in the UI and I need to test that.



    Gena, thanks for the information.