//private void SelectMenu(string automationID) //{ // Execute(() => { // Menu rc = (Menu)mMainWindow.FindName("MainRibbon"); // foreach (RibbonTab RT in rc.Items) // { // if (AutomationProperties.GetAutomationId(RT) == automationID) // { // //mimic user click // //MouseEventArgs - not working... // //MouseDevice mouse = InputManager.Current.PrimaryMouseDevice; // //MouseButtonEventArgs arg = new MouseButtonEventArgs(Mouse.PrimaryDevice, 0, MouseButton.Left); // //arg.RoutedEvent = RibbonTab.PreviewMouseLeftButtonDownEvent; // //RT.RaiseEvent(arg); // // for now use direct change of the tab // rc.SelectedItem = RT; // SleepWithDoEvents(100); // //while (!rc.IsVisible) // //{ // // Thread.Sleep(100); // //} // return; // } // } // throw new Exception("SelectRibbonTab element not found by AutomationID: " + automationID); // }); //} //private void SelectRibbonTab(string automationID) //{ // Execute(() => { // Ribbon rc = (Ribbon)mMainWindow.FindName("MainRibbon"); // foreach (RibbonTab RT in rc.Items) // { // if (AutomationProperties.GetAutomationId(RT) == automationID) // { // //mimic user click // //MouseEventArgs - not working... // //MouseDevice mouse = InputManager.Current.PrimaryMouseDevice; // //MouseButtonEventArgs arg = new MouseButtonEventArgs(Mouse.PrimaryDevice, 0, MouseButton.Left); // //arg.RoutedEvent = RibbonTab.PreviewMouseLeftButtonDownEvent; // //RT.RaiseEvent(arg); // // for now use direct change of the tab // rc.SelectedItem = RT; // SleepWithDoEvents(100); // //while (!rc.IsVisible) // //{ // // Thread.Sleep(100); // //} // return; // } // } // throw new Exception("SelectRibbonTab element not found by AutomationID: " + automationID); // }); //} public EnvironmentsPOM GotoEnvironments() { Environments = null; Execute(() => { ClickResourcesRibbon(); Frame f = (Frame)mMainWindow.FindName("xMainWindowFrame"); TwoLevelMenuPage resourcesPage = (TwoLevelMenuPage)f.Content; ListView lv = (ListView)resourcesPage.FindName("xMainNavigationListView"); lv.SelectedItem = null; foreach (TopMenuItem topMenuItem in lv.Items) { if (topMenuItem.AutomationID == "Environemnts_AID") { lv.SelectedItem = topMenuItem; SleepWithDoEvents(100); Frame f1 = (Frame)FindElementByName(resourcesPage, "xSelectedItemFrame"); SingleItemTreeViewExplorerPage itemExplorerPage = (SingleItemTreeViewExplorerPage)f1.Content; while (!itemExplorerPage.IsVisible) { SleepWithDoEvents(100); } Environments = new EnvironmentsPOM(itemExplorerPage); break; } } }); return(Environments); }
internal GlobalVariablesPOM GotoGlobalVariables() { GlobalVariables = null; Execute(() => { ClickResourcesRibbon(); Frame f = (Frame)mMainWindow.FindName("xMainWindowFrame"); TwoLevelMenuPage resourcesPage = (TwoLevelMenuPage)f.Content; ListView lv = (ListView)resourcesPage.FindName("xMainNavigationListView"); lv.SelectedItem = null; foreach (TopMenuItem topMenuItem in lv.Items) { if (topMenuItem.AutomationID == "Global Variables AID") { lv.SelectedItem = topMenuItem; SleepWithDoEvents(100); Frame f1 = (Frame)FindElementByName(resourcesPage, "xSelectedItemFrame"); VariablesPage variablesPage = (VariablesPage)f1.Content; GlobalVariables = new GlobalVariablesPOM(variablesPage); break; } } }); if (GlobalVariables == null) { throw new Exception("Cannot goto Global Variables"); } return(GlobalVariables); }
internal AgentsPOM GotoAgents() { Agents = null; Execute(() => { ClickConfigurationsRibbon(); Frame f = (Frame)mMainWindow.FindName("MainFrame"); TwoLevelMenuPage configurationsPage = (TwoLevelMenuPage)f.Content; ListView lv = (ListView)configurationsPage.FindName("xMainNavigationListView"); foreach (ListViewItem lvi in lv.Items) { string AID = AutomationProperties.GetAutomationId(lvi); if (AID == "Agents AID") { lv.SelectedItem = lvi; SleepWithDoEvents(100); Frame f1 = (Frame)FindElementByName(configurationsPage, "xSelectedItemFrame"); SingleItemTreeViewExplorerPage itemExplorerPage = (SingleItemTreeViewExplorerPage)f1.Content; while (!itemExplorerPage.IsVisible) { SleepWithDoEvents(100); } Agents = new AgentsPOM(itemExplorerPage); } } }); if (Agents == null) { throw new Exception("Cannot goto Agents"); } return(Agents); }
public EnvironmentsPOM GotoEnvironments() { Environments = null; Execute(() => { ClickConfigurationsRibbon(); Frame f = (Frame)mMainWindow.FindName("MainFrame"); TwoLevelMenuPage configurationsPage = (TwoLevelMenuPage)f.Content; ListView lv = (ListView)configurationsPage.FindName("xMainNavigationListView"); foreach (ListViewItem lvi in lv.Items) { if (AutomationProperties.GetAutomationId(lvi) == "Environemnts_AID") { lv.SelectedItem = lvi; SleepWithDoEvents(100); Frame f1 = (Frame)FindElementByName(configurationsPage, "xSelectedItemFrame"); SingleItemTreeViewExplorerPage itemExplorerPage = (SingleItemTreeViewExplorerPage)f1.Content; while (!itemExplorerPage.IsVisible) { SleepWithDoEvents(100); } Environments = new EnvironmentsPOM(itemExplorerPage); } } }); return(Environments); }
internal POMsPOM GotoPOMs() { Agents = null; Execute(() => { ClickResourcesRibbon(); Frame f = (Frame)mMainWindow.FindName("xMainWindowFrame"); TwoLevelMenuPage resourcesPage = (TwoLevelMenuPage)f.Content; ListView lv = (ListView)resourcesPage.FindName("xMainNavigationListView"); foreach (TopMenuItem topMenuItem in lv.Items) { if (topMenuItem.AutomationID == "Application Models AID") { lv.SelectedItem = topMenuItem; ListView lvi = (ListView)resourcesPage.FindName("xSubNavigationListView"); foreach (SubMenuItem subMenuItem in lvi.Items) { if (subMenuItem.AutomationID == "POM Menu AID") { lvi.SelectedItem = subMenuItem; } } SleepWithDoEvents(100); Frame f1 = (Frame)FindElementByName(resourcesPage, "xSelectedItemFrame"); SingleItemTreeViewExplorerPage itemExplorerPage = (SingleItemTreeViewExplorerPage)f1.Content; while (!itemExplorerPage.IsVisible) { SleepWithDoEvents(100); } POMs = new POMsPOM(itemExplorerPage); break; } } }); return(POMs); }