public void OpenTestExplorer() { if (_uiItem == null) { _mainWindow.VsMenuBarMenuItems("Test", "Windows", "Test Explorer").Click(); _uiItem = _mainWindow.Get <UIItem>("TestWindowToolWindowControl"); } ProgressBar delayIndicator = _uiItem.Get <ProgressBar>("delayIndicatorProgressBar"); _mainWindow.WaitTill(() => delayIndicator.IsOffScreen); }
public Hyperlink OpenWorkspace(Window gMTWindow, string WorkspaceName) { win = gMTWindow; IUIItem leftPane = win.Get(SearchCriteria.ByAutomationId("workspaceSplitter")); return(leftPane.Get <Hyperlink>(SearchCriteria.ByNativeProperty(AutomationElement.NameProperty, WorkspaceName))); }
public Button OpenTab(Window gMTWindow, string tabName) { win = gMTWindow; IUIItem leftPane = win.Get(SearchCriteria.ByAutomationId("stackStrip")); return(leftPane.Get <Button>(SearchCriteria.ByText(tabName))); }
private IUIItem findUIObject(String elementId) { string[] elements = new string[] { elementId, "", "", "" }; IUIItem ui = null; // applies only to special case xpath=//Pane[@text='ss']>>>Edit>>>Settings>>>1 if (elementId.Contains(">>>")) { elements = elementId.Split(new string[] { ">>>" }, StringSplitOptions.RemoveEmptyEntries); AutomationElement parent = (testAppWin.Get(GetBy(elements[0])) as UIItem).AutomationElement; return(simpleDescendantSearch(parent, elements[1], elements[2], Convert.ToInt32(elements[3]))); } else if (elementId.StartsWith("xpath=") && !elementId.Contains(">>>")) { string elementString = elementId.Substring(8); string[] els = elementString.Split(new string[] { "/descendant::" }, StringSplitOptions.RemoveEmptyEntries); short i = 0; foreach (string s in els) { elements[i] = "xpath=//" + s; //Trace.TraceInformation(elements[i]); i++; } } if (elementId.EndsWith(":ROOT")) { ui = Desktop.Instance.Get(GetBy(elements[0])); } else { ui = testAppWin.Get(GetBy(elements[0])); } for (short i = 1; i < elements.Length; i++) { //Trace.TraceInformation(elements[i]); if (elements[i].Length > 0) { ui = ui.Get(GetBy(elements[i])); } } return(ui); }
/// <summary> /// Get the first item of a certain type and a specific Search Criteria /// </summary> /// <typeparam name="T">Type of Item</typeparam> /// <param name="uiItem">The root UI Item from were to start searching</param> /// <param name="searchCriteria">The Search Criteria to use for the Search</param> /// <returns>Located UI Item</returns> public static T Get <T>(this IUIItem uiItem, SearchCriteria searchCriteria) where T : IUIItem { return(searchCriteria == null?uiItem.Get <T>() : GetUiItemContainer(uiItem).Get <T>(searchCriteria)); }
public static string GetOutput() { IUIItem outputWindow = _mainWindow.Get(SearchCriteria.ByText("Output").AndByClassName("GenericPane"), TimeSpan.FromSeconds(10)); return(outputWindow.Get <TextBox>("WpfTextView").Text); }