Forum Discussion

ElChupaNibre's avatar
ElChupaNibre
New Contributor
24 days ago

Identifying menu items via AutomationId

Hi,

I am new to testcomplete and currently trying to test a windows desktop application using the dev express framework.

I am trying to open the popup menu "Display" of my application and then click on the menu item "Load layout".

I would like to identify all elements via AutomationId so that I don't have to update my tests if a new menu item is added to the application. I don't want  to navigate to the corresponding menu item via up/down keys or use some coordinate-dependent clicks.

The opening of the Display menu works. The LoadLayout element is found, but the click is not executed:

Here is my code (python): 


    openDisplayMenu = myapp.Find("WPFControlAutomationId", "Display", 100)
    openDisplayMenu.Click()    


    importLayout = myapp.Find("WPFControlAutomationId", "LoadLayout", 100)
    importLayout.Click()


Could it be that this  is not supported by testcomplete, or have I made a mistake somewhere?

Thank you for your help!

  • As suggested, it could be the control is not supported.  If you look at the properties of the menu with the Spy tool do you see any methods for selecting items in the list.  Make sure you have the Spy tool set to show advance members.

    Arrow key navigation, as you described, is definitely not ideal.  However, using accelerator keys, if they are hooked up, avoids the pitfalls of arrow keys if/when new menu items are added. When you press Alt you'll see the accelerator keys underlined in the app  .As an example in TestComplete try pressing Alt+f+o.  That will open the File Open dialog using the keyboard accelerators.  
    In Automation you could accomplish that by sending keystrokes to the application object.  In VB that would be myapp.keys("~fo").  Sorry, I don't do Python.

    I use keyboard accelerators a lot to work around problems like you encountered. 

    Best regards,
    John