WpfMenuItem .SearchConfigurations.Add("ExpandWhileSearching");

Mar 6, 2015 at 4:46 PM
Edited Mar 6, 2015 at 4:46 PM
I am looking to work with the File|New|New Project... dialog in Visual Studio 2013 to test an addin.

I am finding that I can successfully click the 'File' Menuitem in Visual Studio by using this code:
    public CUITe_WpfMenuItem mnuFile
    {
        get{return Get<CUITe_WpfMenuItem>("name=File;");}
    }
However I am trying to click the next menu level, "New". And in standard codedUI I would add the following:
    public static WpfMenuItem VisualStudioMenuNew(ApplicationUnderTest aut)
    {
        var visualStudioMenuNew = new WpfMenuItem(aut);
        visualStudioMenuNew.SearchConfigurations.Add(SearchConfiguration.ExpandWhileSearching);
        visualStudioMenuNew.SearchProperties.Add(UITestControl.PropertyNames.Name, "New");
        visualStudioMenuNew.WindowTitles.Add("Start Page - Microsoft Visual Studio (Administrator)");
        return visualStudioMenuNew;
    }
However I am now seeing how to add a .SearchConfiguration to the CUITe_WpfMenuItem mnuFile method.

How can I specify Search Configuration Options using CUITe objects?
Coordinator
Jan 23, 2016 at 6:51 PM
With the latest code, you can call
mnuFile.SourceControl.SearchConfigurations.Add(SearchConfiguration.ExpandWhileSearching)
With older code, you can call
mnuFile.UnWrap().SearchConfigurations.Add(SearchConfiguration.ExpandWhileSearching)
Thank you.