/// <summary> /// VerifyClassifierListedInClassifierListOnOpenClassifierWindow - Use 'VerifyClassifierListedInClassifierListOnOpenClassifierWindowExpectedValues' to pass parameters into this method. /// </summary> public void VerifyClassifierListedInClassifierListOnOpenClassifierWindow(String classifierName) { #region Variable Declarations WinListItem uIATM7156ListItem = this.UIOpenClassifierWindow.UIListFilesWindow.UIATM7156ListItem; WinList uIListFilesList = this.UIOpenClassifierWindow.UIListFilesWindow.UIListFilesList; #endregion int noOfClassifiers = uIListFilesList.GetChildren().Count; for (int index = 0; index < noOfClassifiers; index++) { String name = uIListFilesList.GetChildren()[index].Name; if (name.Equals(classifierName)) { break; } if (index == noOfClassifiers - 2) { Assert.Fail("Created classifier is not available in Open Classifier list. Classifier name is : " + classifierName); } } // Verify that 'ATM7156' list item's property 'Exists' equals 'True' // Assert.AreEqual(this.VerifyClassifierListedInClassifierListOnOpenClassifierWindowExpectedValues.UIATM7156ListItemExists, uIATM7156ListItem.Exists); // Verify that 'listFiles' list box's property 'Exists' equals 'True' // Assert.AreEqual(this.VerifyClassifierListedInClassifierListOnOpenClassifierWindowExpectedValues.UIListFilesListExists, uIListFilesList.Exists); }
/// <summary> /// DisplaySelectedFeatures_1 - Use 'DisplaySelectedFeatures_1Params' to pass parameters into this method. /// </summary> public void DisplaySelectedFeatures_1() { #region Variable Declarations WinButton uIItemButton = this.UIFeatureSelectionWindow.UIItemWindow1.UIItemButton; WinList uIItemList = this.UIFeatureSelectionWindow.UIItemWindow.UIItemList; WinButton uIItemButton1 = this.UIFeatureSelectionWindow.UIItemWindow2.UIItemButton; WinListItem uIDownwebCenterListItem = this.UIFeatureSelectionWindow.UIItemWindow.UIDownwebCenterListItem; WinMenuItem uISetAllMenuItem = this.UIItemWindow1.UIContextMenu.UISetAllMenuItem; WinButton uIOKButton = this.UIFeatureSelectionWindow.UIOKWindow.UIOKButton; #endregion // Click 'Unknown Name' button Mouse.Click(uIItemButton, new Point(12, 13)); // Select 'Defect No.,Class,Bottom,Right,Left' in 'Unknown Name' list box uIItemList.SelectedItemsAsString = this.DisplaySelectedFeatures_1Params.UIItemListSelectedItemsAsString; // Click 'Unknown Name' button Mouse.Click(uIItemButton1, new Point(11, 15)); // Right-Click 'Downweb Center' list item Mouse.Click(uIDownwebCenterListItem, MouseButtons.Right, ModifierKeys.None, new Point(59, 6)); // Click 'Set All' menu item Mouse.Click(uISetAllMenuItem, new Point(39, 8)); // Click 'OK' button Mouse.Click(uIOKButton, new Point(29, 9)); }
/// <summary> /// SetRowSeverityThresholdAndAssignNotification - Use 'SetRowSeverityThresholdAndAssignNotificationParams' to pass parameters into this method. /// </summary> public void SetRowSeverityThresholdAndAssignNotification(String rowSeverityThreshold) { #region Variable Declarations WinEdit uIItemEdit = this.UISmartViewRecipeManagWindow.UITileMapDefinitionStaWindow.UIItem0Window1.UIItemEdit; WinButton uINotificationButton = this.UISmartViewRecipeManagWindow.UITileMapDefinitionStaWindow.UINotificationWindow.UINotificationButton; WinList uIItemList = this.UISmartViewRecipeManagWindow.UIRowSeverityNotificatWindow.UIItemWindow.UIItemList; WinButton uIApplyButton = this.UISmartViewRecipeManagWindow.UIRowSeverityNotificatWindow.UIApplyWindow.UIApplyButton; WinButton uIOKButton = this.UISmartViewRecipeManagWindow.UIRowSeverityNotificatWindow.UIOKWindow.UIOKButton; #endregion // Type '99929' in 'Unknown Name' text box uIItemEdit.Text = rowSeverityThreshold; // Click 'Notification...' button Mouse.Click(uINotificationButton, new Point(45, 10)); // Select 'Output 1,Output 2' in 'Unknown Name' list box uIItemList.SelectedItemsAsString = this.SetRowSeverityThresholdAndAssignNotificationParams.UIItemListSelectedItemsAsString; // Click 'Apply' button Mouse.Click(uIApplyButton, new Point(29, 15)); // Click 'OK' button Mouse.Click(uIOKButton, new Point(48, 11)); }
/// <summary> /// CloseSVConsole - Use 'CloseSVConsoleParams' to pass parameters into this method. /// </summary> public void CloseSVConsole() { #region Variable Declarations WinToolBar uIRunningapplicationsToolBar = this.UIRunningapplicationsWindow.UIRunningapplicationsClient.UIRunningapplicationsToolBar; WinMenuItem uIStartTaskManagerMenuItem = this.UIItemWindow.UIContextMenu.UIStartTaskManagerMenuItem; WinList uIItemList = this.UIWindowsTaskManagerWindow.UIProcessesWindow.UIItemList; WinButton uIEndProcessButton = this.UIWindowsTaskManagerWindow.UIEndProcessWindow.UIEndProcessButton; WinButton uIEndprocessButton = this.UIWindowsTaskManagerWindow1.UIWindowsTaskManagerPane.UIEndprocessButton; #endregion // Right-Click 'Running applications' tool bar Mouse.Click(uIRunningapplicationsToolBar, MouseButtons.Right, ModifierKeys.None, new Point(539, 19)); // Click 'Start Task Manager' menu item Mouse.Click(uIStartTaskManagerMenuItem, new Point(75, 13)); // Select 'Console.exe *32' in 'Unknown Name' list box uIItemList.SelectedItemsAsString = this.CloseSVConsoleParams.UIItemListSelectedItemsAsString; // Click '&End Process' button Mouse.Click(uIEndProcessButton, new Point(31, 10)); // Click 'End process' button Mouse.Click(uIEndprocessButton, new Point(26, 7)); }
/// <summary> /// DefineQuerySelectedClasses - Use 'DefineQuerySelectedClassesParams' to pass parameters into this method. /// </summary> public void DefineQuerySelectedClasses(bool isEnabled) { #region Variable Declarations WinRadioButton uISelectedclassesRadioButton = this.UIQueryDefinitionWindow.UISelectedclassesWindow.UISelectedclassesRadioButton; WinListItem uIDiscreteExtremeBrighListItem = this.UIQueryDefinitionWindow.UIItemWindow.UIDiscreteExtremeBrighListItem; WinMenuItem uIClearAllMenuItem = this.UIItemWindow1.UIContextMenu.UIClearAllMenuItem; WinList uIItemList = this.UIQueryDefinitionWindow.UIItemWindow.UIItemList; #endregion // Select 'Selected classes' radio button uISelectedclassesRadioButton.Selected = isEnabled; if (isEnabled) { // Right-Click 'Discrete Extreme Bright' list item Mouse.Click(uIDiscreteExtremeBrighListItem, MouseButtons.Right, ModifierKeys.None, new Point(53, 14)); // Click 'Clear All' menu item Mouse.Click(uIClearAllMenuItem, new Point(34, 11)); // Select 'Discrete Extreme Bright' in 'Unknown Name' list box // uIItemList.SelectedItemsAsString = this.DefineQuerySelectedClassesParams.UIItemListSelectedItemsAsString; // Select 'Discrete Extreme Bright,Discrete Bright,Discrete Extreme Dark,Low Density Bright' in 'Unknown Name' list box uIItemList.SelectedItemsAsString = this.DefineQuerySelectedClassesParams.UIItemListSelectedItemsAsString1; } }
/// <summary> /// MatchDeposit - Use 'MatchDepositParams' to pass parameters into this method. /// </summary> public void MatchDeposit() { #region Variable Declarations WinEdit uIOMATransSeqNoEdit = this.UICommercialDepositDesWindow.UIItemWindow2.UIOMATransSeqNoEdit; WinButton uIFindDepositButton = this.UICommercialDepositDesWindow.UIFindDepositWindow.UIFindDepositButton; WinList uIItemList = this.UICommercialDepositDesWindow.UIItemWindow11.UIItemList; WinEdit uIDepositserialnumberEdit = this.UICommercialDepositDesWindow.UIItemWindow21.UIDepositserialnumberEdit; WinButton uIMatchDepositButton = this.UICommercialDepositDesWindow.UIMatchDepositWindow.UIMatchDepositButton; #endregion // Type '0302' in 'OMA Trans. Seq. No.' text box uIOMATransSeqNoEdit.Text = this.MatchDepositParams.UIOMATransSeqNoEditText; System.Threading.Thread.Sleep(500); // Click '&Find Deposit' button Mouse.Click(uIFindDepositButton, new Point(32, 16)); System.Threading.Thread.Sleep(500); // Select '201' in 'Unknown Name' list box uIItemList.SelectedItemsAsString = this.MatchDepositParams.UIItemListSelectedItemsAsString; // Type '1005' in 'Deposit serial number:' text box uIDepositserialnumberEdit.Text = this.MatchDepositParams.UIDepositserialnumberEditText; System.Threading.Thread.Sleep(500); // Click '&Match Deposit' button Mouse.Click(uIMatchDepositButton, new Point(35, 14)); }
/// <summary> /// DefineQueryLanes - Use 'DefineQueryLanesParams' to pass parameters into this method. /// </summary> public void DefineQueryLanes() { #region Variable Declarations WinList uIItemList = this.UIQueryDefinitionWindow.UIItemWindow1.UIItemList; WinButton uIRetryButton = this.UISmartViewConsoleWindow.UIRetryWindow.UIRetryButton; WinList uIItemList1 = this.UIQueryDefinitionWindow.UIItemWindow2.UIItemList; WinListItem uIItem1ListItem = this.UIQueryDefinitionWindow.UIItemWindow3.UIItem1ListItem; WinListItem uIItem1ListItem1 = this.UIQueryDefinitionWindow.UIItemWindow4.UIItem1ListItem; WinMenuItem uIClearAllMenuItem = this.UIItemWindow1.UIContextMenu.UIClearAllMenuItem; #endregion // Select '2,3,4,5,6,7,8,9' in 'Unknown Name' list box uIItemList.SelectedItemsAsString = this.DefineQueryLanesParams.UIItemListSelectedItemsAsString; // Click '&Retry' button Mouse.Click(uIRetryButton, new Point(53, 14)); // Select '3,4,5,6,7,8,9' in 'Unknown Name' list box uIItemList1.SelectedItemsAsString = this.DefineQueryLanesParams.UIItemListSelectedItemsAsString1; // Right-Click '1' list item Mouse.Click(uIItem1ListItem, MouseButtons.Right, ModifierKeys.None, new Point(12, 8)); // Click '&Retry' button Mouse.Click(uIRetryButton, new Point(54, 13)); // Right-Click '1' list item Mouse.Click(uIItem1ListItem1, MouseButtons.Right, ModifierKeys.None, new Point(19, 7)); // Click 'Clear All' menu item Mouse.Click(uIClearAllMenuItem, new Point(37, 17)); }
/// <summary> /// Positivtest2 - Verwenden Sie "Positivtest2Params", um Parameter an diese Methode zu übergeben. /// </summary> public void Positivtest2() { #region Variable Declarations WinEdit uINameEdit = this.UIDebugWindow.UIItemWindow.UIM120LB2FS17ListItem.UINameEdit; WpfListItem uISystemDynamicExpandoListItem = this.UIMainWindowWindow.UILb_vermietungList.UISystemDynamicExpandoListItem; WpfText uIItem6102017110000AMText = this.UIMainWindowWindow.UIItemCustom.UIDg_vermietungTable.UIItem2Row.UIItem6102017110000AMCell.UIItem6102017110000AMText; WinList uIElementansichtList = this.UIDebugWindow.UIShellViewWindow.UIShellViewClient.UIElementansichtList; WpfButton uIHauptmenuButton = this.UIMainWindowWindow.UIItemCustom.UIHauptmenuButton; WinButton uISchließenButton = this.UIMainWindowWindow1.UISchließenButton; #endregion // Doppelklicken "Name" Textfeld Mouse.DoubleClick(uINameEdit, new Point(116, 12)); // Klicken "System.Dynamic.ExpandoObject" Listenelement Mouse.Click(uISystemDynamicExpandoListItem, new Point(186, 7)); // Klicken "6/10/2017 11:00:00 AM" Bezeichnung Mouse.Click(uIItem6102017110000AMText, new Point(41, 10)); // "{NumPad7}{Divide}{NumPad6}{Divide}{NumPad2}{NumPad0}{NumPad4}{Back}{NumPad1}{NumPad7}{Space}{NumPad1}{NumPad2}{NumPad0}{Back}{LShiftKey}:00{Tab}" in "Elementansicht" Listenfeld eingeben Keyboard.SendKeys(uIElementansichtList, this.Positivtest2Params.UIElementansichtListSendKeys, ModifierKeys.None); // "{NumPad7}{Divide}{NumPad6}{Divide}{NumPad2}{NumPad0}{NumPad1}{NumPad7}{Space}{NumPad1}{NumPad8}{LShiftKey}:30" in "Elementansicht" Listenfeld eingeben Keyboard.SendKeys(uIElementansichtList, this.Positivtest2Params.UIElementansichtListSendKeys1, ModifierKeys.None); // "{Enter}" in "Elementansicht" Listenfeld eingeben Keyboard.SendKeys(uIElementansichtList, this.Positivtest2Params.UIElementansichtListSendKeys2, ModifierKeys.None); // Klicken "Hauptmenu" Schaltfläche Mouse.Click(uIHauptmenuButton, new Point(259, 7)); // Klicken "Schließen" Schaltfläche Mouse.Click(uISchließenButton, new Point(14, 16)); }
public static void AssertListViewItemByIndex(string name, int index, string text) { WinList list = (WinList)Robot.FindWinControl(typeof(WinList), name, _root); WinListItem item = list.Items[index] as WinListItem; Assert.AreEqual(item.DisplayText, text); }
/// <summary> /// AssignClassifierToRecipe - Use 'AssignClassifierToRecipeParams' to pass parameters into this method. /// </summary> public void AssignClassifierToRecipe(String name) { #region Variable Declarations WinClient uIWorkspaceClient = this.UISmartViewRecipeManagWindow1.UIItemWindow.UIWorkspaceClient; WinTreeItem uIBasicTreeItem = this.UISmartViewRecipeManagWindow1.UIItemWindow1.UIItemTree.UILineTreeItem.UIStationTreeItem.UIView1TreeItem.UIBasicTreeItem; WinMenuItem uISelectClassifierMenuItem = this.UIItemWindow.UIContextMenu.UISelectClassifierMenuItem; WinList uIItemList = this.UISelectClassifierWindow.UIItemWindow.UIItemList; WinButton uIOKButton = this.UISelectClassifierWindow.UIOKWindow.UIOKButton; #endregion uIBasicTreeItem.WindowTitles.Add("SmartView Recipe Manager - " + name); // Click 'Workspace' client //Mouse.Click(uIWorkspaceClient, new Point(501, 481)); // Click 'Line' -> 'Station' -> 'View 1' -> 'Basic' tree item Mouse.Click(uIBasicTreeItem, new Point(12, 8)); // Right-Click 'Line' -> 'Station' -> 'View 1' -> 'Basic' tree item Mouse.Click(uIBasicTreeItem, MouseButtons.Right, ModifierKeys.None, new Point(12, 8)); // Click 'Select Classifier...' menu item Mouse.Click(uISelectClassifierMenuItem, new Point(36, 13)); // Select 'Basic-Test' in 'Unknown Name' list box uIItemList.SelectedItemsAsString = name; // Click 'OK' button Mouse.Click(uIOKButton, new Point(52, 17)); }
public void SendBingo(PhotonPlayer photonP) { GlobalVariables.m_instance.Bingo = true; StopAllCoroutines(); if (WinnerList.Count == 0) { WinList newAdd = new WinList(); newAdd.pseudoWin = photonP.NickName; newAdd.photonP = photonP; WinnerList.Add(newAdd); } else { foreach (WinList photonInWinList in WinnerList) { if (photonP != photonInWinList.photonP) { WinList newAdd = new WinList(); newAdd.pseudoWin = photonP.NickName; newAdd.photonP = photonP; WinnerList.Add(newAdd); } } } StartCoroutine(verifWinner()); }
/// <summary> /// DefineQueryByLanes - Use 'DefineQueryByLanesParams' to pass parameters into this method. /// </summary> public void DefineQueryByLanes(bool allLanes) { #region Variable Declarations WinListItem uIItem1ListItem = this.UIQueryDefinitionWindow.UIItemWindow2.UIItem1ListItem; WinMenuItem uIClearAllMenuItem = this.UIItemWindow1.UIContextMenu.UIClearAllMenuItem; WinList uIItemList = this.UIQueryDefinitionWindow.UIItemWindow2.UIItemList; WinListItem uIItem4ListItem = this.UIQueryDefinitionWindow.UIItemWindow2.UIItem4ListItem; WinMenuItem uISetAllMenuItem = this.UIItemWindow1.UIContextMenu.UISetAllMenuItem; #endregion if (!allLanes) { // Right-Click '1' list item Mouse.Click(uIItem1ListItem, MouseButtons.Right, ModifierKeys.None, new Point(19, 10)); // Click 'Clear All' menu item Mouse.Click(uIClearAllMenuItem, new Point(23, 11)); // Select '1,2,3' in 'Unknown Name' list box uIItemList.SelectedItemsAsString = this.DefineQueryByLanesParams.UIItemListSelectedItemsAsString; } if (allLanes) { // Right-Click '4' list item Mouse.Click(uIItem4ListItem, MouseButtons.Right, ModifierKeys.None, new Point(12, 8)); // Click 'Set All' menu item Mouse.Click(uISetAllMenuItem, new Point(34, 8)); } }
/// <summary> /// MotoAmendRiskNew_1 - Use 'MotoAmendRiskNew_1Params' to pass parameters into this method. /// </summary> public void MotoAmendRiskNew_1() { #region Variable Declarations WinCheckBox uIDeferPrintingCheckBox = this.UIPrintDocumentsWindow.UIDeferPrintingWindow.UIDeferPrintingCheckBox; WinButton uIOKButton = this.UIPrintDocumentsWindow.UIOKWindow.UIOKButton; WinButton uIOKButton1 = this.UIInsurEtamWindow1.UIOKWindow.UIOKButton; WinCheckBox uIAddActivityCheckBox = this.UIImporttoTAMWindow.UIImportOptionsClient.UIAddActivityCheckBox; WinButton uIOKButton2 = this.UIImporttoTAMWindow.UIPanel1Client.UIOKButton; WinButton uIOKButton3 = this.UITransactiontoinsertWindow.UIItemWindow.UITransactiontoinsertClient.UIOKButton; WinList uIItemList = this.UIPleaseselectWHOtofolWindow.UIItemWindow1.UIItemList; WinButton uIOKButton4 = this.UIPleaseselectWHOtofolWindow.UIItemWindow.UIPleaseselectWHOtofolClient.UIOKButton; WinButton uIOKButton5 = this.UITamxml7Window.UITamxml7Client.UIOKButton; WinButton uIExitButton = this.UIInsurEtamWindow.UIMotorQuotesWindow.UIExitWindow1.UIExitButton; WinButton uIYesButton = this.UIInsurEtamWindow1.UIYesWindow.UIYesButton; #endregion // Set flag to allow play back to continue if non-essential actions fail. (For example, if a mouse hover action fails.) Playback.PlaybackSettings.ContinueOnError = true; // Select '&Defer Printing?' check box uIDeferPrintingCheckBox.Checked = this.MotoAmendRiskNew_1Params.UIDeferPrintingCheckBoxChecked; // Click 'Ok' button Mouse.Click(uIOKButton, new Point(59, 11)); // Click 'OK' button Mouse.Click(uIOKButton1, new Point(54, 6)); // Click 'OK' button Mouse.Click(uIOKButton1, new Point(50, 20)); // Reset flag to ensure that play back stops if there is an error. Playback.PlaybackSettings.ContinueOnError = false; // Clear 'Add Activity' check box uIAddActivityCheckBox.Checked = this.MotoAmendRiskNew_1Params.UIAddActivityCheckBoxChecked; // Click 'Ok' button Mouse.Click(uIOKButton2, new Point(47, 13)); // Click '&Ok' button Mouse.Click(uIOKButton3, new Point(55, 14)); // Select 'AG Administrator General' in 'Unknown Name' list box uIItemList.SelectedItemsAsString = this.MotoAmendRiskNew_1Params.UIItemListSelectedItemsAsString; // Click '&Ok' button Mouse.Click(uIOKButton4, new Point(56, 11)); // Click 'OK' button Mouse.Click(uIOKButton5, new Point(48, 12)); etam_ok(); // Click 'E&xit' button Mouse.Click(uIExitButton, new Point(47, 18)); // Click '&Yes' button Mouse.Click(uIYesButton, new Point(51, 7)); }
public static void ClickListViewItemByIndex(string name, int index) { WinList list = (WinList)Robot.FindWinControl(typeof(WinList), name, _root); WinListItem item = list.Items[index] as WinListItem; Mouse.Click(item); }
/// <summary> /// CreateNewClassifier - Use 'CreateNewClassifierParams' to pass parameters into this method. /// </summary> public void CreateNewClassifier(String viewType, String classifierType, String engine, bool isUseDefaultParameters) { #region Variable Declarations WinMenuItem uINewCtrlNMenuItem = this.UISmartLearnClassifierWindow.UIMainFormMenuBar.UIFileMenuItem.UINewCtrlNMenuItem; WinRadioButton uISynchronizedRadioButton = this.UINewClassifierWindow.UISynchronizedWindow.UISynchronizedRadioButton; WinRadioButton uIMarkreaderRadioButton = this.UINewClassifierWindow.UIMarkreaderWindow.UIMarkreaderRadioButton; WinRadioButton uIStandardRadioButton = this.UINewClassifierWindow.UIStandardWindow.UIStandardRadioButton; WinRadioButton uISmartLearnmultistepRadioButton = this.UINewClassifierWindow.UISmartLearnmultistepWindow.UISmartLearnmultistepRadioButton; WinList uIListEnginesList = this.UINewClassifierWindow.UIListEnginesWindow.UIListEnginesList; WinCheckBox uIUsedefaultparametersCheckBox = this.UINewClassifierWindow.UIUsedefaultparametersWindow.UIUsedefaultparametersCheckBox; WinRadioButton uISmartViewstandardRadioButton = this.UINewClassifierWindow.UISmartViewstandardWindow.UISmartViewstandardRadioButton; WinButton uIOKButton = this.UINewClassifierWindow.UIOKWindow.UIOKButton; #endregion // Click 'File' -> 'New... Ctrl+N' menu item Mouse.Click(uINewCtrlNMenuItem, new Point(37, 11)); if (viewType.Equals("Synchronized")) { // Select 'Synchronized' radio button uISynchronizedRadioButton.Selected = this.CreateNewClassifierParams.UISynchronizedRadioButtonSelected; } if (viewType.Equals("Mark reader")) { // Select 'Mark reader' radio button uIMarkreaderRadioButton.Selected = this.CreateNewClassifierParams.UIMarkreaderRadioButtonSelected; } if (viewType.Equals("Standard")) { // Select 'Standard' radio but//on uIStandardRadioButton.Selected = this.CreateNewClassifierParams.UIStandardRadioButtonSelected; } if (classifierType.Equals("SmartLearn")) { // Select 'SmartLearn (multi-step)' radio button uISmartLearnmultistepRadioButton.Selected = this.CreateNewClassifierParams.UISmartLearnmultistepRadioButtonSelected; // Select 'Decision tree' in 'listEngines' list box uIListEnginesList.SelectedItemsAsString = engine; if (isUseDefaultParameters) { // Select 'Use default parameters' check box uIUsedefaultparametersCheckBox.Checked = this.CreateNewClassifierParams.UIUsedefaultparametersCheckBoxChecked; } } if (classifierType.Equals("SmartView")) { // Select 'SmartView (standard)' radio button uISmartViewstandardRadioButton.Selected = this.CreateNewClassifierParams.UISmartViewstandardRadioButtonSelected; } // Click 'OK' button Mouse.Click(uIOKButton, new Point(24, 15)); }
public static List<string> GetListOfItems(WinList control) { var items = control.GetProperty("Items") as UITestControlCollection; return (from WinListItem item in items select item.DisplayText).ToList(); }
private static WinList GetWinList(string uiTitle, string uiType) { var htmlcontrolWin = new WinList(Window.Locate(uiTitle, uiType, false)); var htmlControlWin = htmlcontrolWin; htmlControlWin.TechnologyName = TechnologyNameWin; return(htmlControlWin); }
/// <summary> /// Tells if a List is empty or not. /// </summary> /// <exception cref="ArgumentNullException">list</exception> public static bool IsEmpty(this WinList list) { if (list == null) { throw new ArgumentNullException("list"); } return(list.Items.Count == 0); }
/// <summary> /// VerifyLegendIsShownInTrendViewer - Use 'VerifyLegendIsShownInTrendViewerExpectedValues' to pass parameters into this method. /// </summary> public void VerifyLegendIsShownInTrendViewer(bool isLegendShown) { #region Variable Declarations WinList uIListboxList = this.UISmartViewProductionQWindow.UITrendViewerWindow.UIListboxWindow.UIListboxList; #endregion // Verify that 'listbox' list box's property 'Exists' equals 'True' Assert.AreEqual(isLegendShown, uIListboxList.Exists); }
/// <summary> /// AssertSelectedOne - Используйте "AssertSelectedOneExpectedValues" для передачи параметров в этот метод. /// </summary> public void AssertSelectedOne() { #region Variable Declarations WinList uILbSelectedList = this.UIMainWindow.UILbSelectedWindow.UILbSelectedList; #endregion // Убедитесь, что свойство SelectedItemsAsString "LbSelected" список равняется "1" Assert.AreEqual(this.AssertSelectedOneExpectedValues.UILbSelectedListSelectedItemsAsString, uILbSelectedList.Items.Count.ToString()); }
public void Init() { //初始化窗体资源列表 WinList.InitResPath(); _DictionaryPaths = WinList.DicUIResPath; //字段初始化 _DicAllUiFormses = new Dictionary <EM_WinType, BaseUIForms>(); _DicCurrentUIForm = new Dictionary <EM_WinType, BaseUIForms>(); }
/// <summary> /// SelectArchitectureFromArchitectureSelectionWindow - Use 'SelectArchitectureFromArchitectureSelectionWindowParams' to pass parameters into this method. /// </summary> public void SelectArchitectureFromArchitectureSelectionWindow(String architecture) { #region Variable Declarations WinList uIItemList = this.UIArchitectureSelectioWindow.UIItemWindow1.UIItemList; #endregion // Select '4 Camera' in 'Unknown Name' list box uIItemList.SelectedItemsAsString = architecture; }
/// <summary> /// SelectArchitectureInRecipeWizard - Use 'SelectArchitectureInRecipeWizardParams' to pass parameters into this method. /// </summary> public void SelectArchitectureInRecipeWizard(String architecture) { #region Variable Declarations WinList uIItemList = this.UIRecipeWizardWindow.UIItemWindow.UIItemList; #endregion // Select '2 Views' in 'Unknown Name' list box uIItemList.SelectedItemsAsString = architecture; }
/// <summary> /// SelectRecord - Use 'SelectRecordParams' to pass parameters into this method. /// </summary> public void SelectRecord() { #region Variable Declarations WinList uIListvwDataList = this.UISmartViewDataSelectoWindow.UIListvwDataWindow.UIListvwDataList; #endregion // Select '1-11' in 'listvwData' list box //uIListvwDataList.SelectedItemsAsString = this.SelectRecordParams.UIListvwDataListSelectedItemsAsString; }
/// <summary> /// DefineAnalysisMethodsStatistical - Use 'DefineAnalysisMethodsStatisticalParams' to pass parameters into this method. /// </summary> public void DefineAnalysisMethodsStatistical() { #region Variable Declarations WinList uIItemList = this.UISmartViewRecipeManagWindow.UISheetQualityAnalysisWindow.UIItemWindow1.UIItemList; #endregion // Select 'Statistical,Textural' in 'Unknown Name' list box uIItemList.SelectedItemsAsString = this.DefineAnalysisMethodsStatisticalParams.UIItemListSelectedItemsAsString; }
/// <summary> /// Clicks the ListView to empty. /// </summary> /// <param name="name">The name.</param> /// <param name="data">The data.</param> public static void ClickListViewToEmpty(string name, string data) { WinWindow window = new WinWindow(); window.SearchProperties[WinWindow.PropertyNames.Name] = name; window.WindowTitles.Add("Task Type"); WinList list = new WinList(window); list.SelectedItemsAsString = null; }
/// <summary> /// SelectItemInListUsingDownKey - Use 'SelectItemInListUsingDownKeyParams' to pass parameters into this method. /// </summary> public void SelectItemInListUsingDownKey() { #region Variable Declarations WinList uIListvwDataList = this.UISmartViewDataSelectoWindow.UIListvwDataWindow.UIListvwDataList; #endregion // Select 'SQATesting-1' in 'listvwData' list box uIListvwDataList.SelectedItemsAsString = this.SelectItemInListUsingDownKeyParams.UIListvwDataListSelectedItemsAsString; // Select 'Tuesday-13' in 'listvwData' list box uIListvwDataList.SelectedItemsAsString = this.SelectItemInListUsingDownKeyParams.UIListvwDataListSelectedItemsAsString1; }
public static void SelectFromList(WinList control, string value) { var currentValue = GetSelectedValue(control); var allValues = GetListOfItems(control); foreach (var item in allValues.Where(item => item != currentValue)) { control.SetFocus(); control.SelectedItemsAsString = value; break; } }
/// <summary> /// RemoveSquats - Используйте "RemoveSquatsParams" для передачи параметров в этот метод. /// </summary> public void RemoveSquats() { #region Variable Declarations WinList uILbSelectedList = this.UIMainWindow.UILbSelectedWindow.UILbSelectedList; WinButton uIItemButton = this.UIMainWindow.UIItemWindow1.UIItemButton; #endregion // Выберите "Squats" в "LbSelected" список uILbSelectedList.SelectedItemsAsString = this.RemoveSquatsParams.UILbSelectedListSelectedItemsAsString; // Щелкните "<" кнопка Mouse.Click(uIItemButton, new Point(37, 9)); }
/// <summary> /// AddSquats - Используйте "AddSquatsParams" для передачи параметров в этот метод. /// </summary> public void AddSquats() { #region Variable Declarations WinList uILbAllList = this.UIMainWindow.UILbAllWindow.UILbAllList; WinButton uIItemButton = this.UIMainWindow.UIItemWindow.UIItemButton; #endregion // Выберите "Squats" в "LbAll" список uILbAllList.SelectedItemsAsString = this.AddSquatsParams.UILbAllListSelectedItemsAsString; // Щелкните ">" кнопка Mouse.Click(uIItemButton, new Point(20, 13)); }
/// <summary> /// SelectandMatchDeposit - Use 'SelectandMatchDepositParams' to pass parameters into this method. /// </summary> public void SelectandMatchDeposit() { #region Variable Declarations WinList uIItemList = this.UICommercialDepositDesWindow.UIItemWindow3.UIItemList; WinButton uIMatchDepositButton = this.UICommercialDepositDesWindow.UIMatchDepositWindow.UIMatchDepositButton; #endregion System.Threading.Thread.Sleep(500); // Select '50007-815' in 'Unknown Name' list box uIItemList.SelectedItemsAsString = this.SelectandMatchDepositParams.UIItemListSelectedItemsAsString; System.Threading.Thread.Sleep(500); // Click '&Match Deposit' button Mouse.Click(uIMatchDepositButton, new Point(113, 11)); }
/// <summary> /// GenerateCustomeReport - Use 'GenerateCustomeReportParams' to pass parameters into this method. /// </summary> public void GenerateCustomeReport(String customReportName) { #region Variable Declarations WinList uIListSettingsList = this.UIReportBrowserWindow.UIListSettingsWindow.UIListSettingsList; WinButton uIPreviewButton = this.UIReportBrowserWindow.UIPreviewWindow.UIPreviewButton; #endregion // Select 'CustomReport703081726191377122711582161557558326421623107761898520309370271228' in 'listSettings' list box uIListSettingsList.SelectedItemsAsString = customReportName; // Click 'Preview' button Mouse.Click(uIPreviewButton, new Point(42, 10)); }
public WinList GetCUITList(WinWindow w, string searchBy, string searchValue, int index) { Console.WriteLine("Inside function GetCUITList"); WinList GetCUITList = new WinList(w); try { Playback.Initialize(); switch (searchBy.Trim().ToLower()) { case "text": { if (index == -1) { GetCUITList.SearchProperties[WinList.PropertyNames.Name] = searchValue; } else { GetCUITList.SearchProperties.Add(WinList.PropertyNames.Name, searchValue); UITestControlCollection checkboxCollection = GetCUITList.FindMatchingControls(); GetCUITList = (WinList)checkboxCollection[index]; } break; } case "automationid": { if (index == -1) { GetCUITList.SearchProperties.Add(WinList.PropertyNames.ControlName, searchValue); UITestControlCollection checkboxCollection = GetCUITList.FindMatchingControls(); GetCUITList = (WinList)checkboxCollection[0]; } else { GetCUITList.SearchProperties.Add(WinList.PropertyNames.ControlName, searchValue); UITestControlCollection checkboxCollection = GetCUITList.FindMatchingControls(); GetCUITList = (WinList)checkboxCollection[index]; } break; } case "notext": { UITestControlCollection checkboxCollection = w.GetChildren(); for (int i = 0; i < checkboxCollection.Count; i++) { UITestControl control = checkboxCollection[i]; if (control.ControlType.ToString().ToLower() == "winlist") { GetCUITList = (WinList)control; } } break; } default: throw new Exception(_error); } Playback.Cleanup(); Console.WriteLine("Found List and exiting function GetCUITList"); return GetCUITList; } catch (Exception e) { var st = new StackTrace(e, true); var testFrame = st.GetFrame(0); for (int i = 0; i < st.FrameCount; i++) { testFrame = st.GetFrame(i); if (testFrame.GetFileName() != null) { if (testFrame.GetFileName().ToString().Contains("CUITFramework.cs") == true) { break; } } } // Get the top stack frame var frame = testFrame; // Get the line number from the stack frame var line = frame.GetFileLineNumber(); logTofile(_eLogPtah, "Error in GetCUITCHeckbox and in line: " + line); throw new Exception(_error + "CUITRButton:" + System.Environment.NewLine + e.Message); } }
private void AddData(int rowPosition) { string parentType = ""; string parentSearchBy = ""; string parentSearchValue = ""; string controlaction = ""; string section = ""; var _controlType = ""; var _logicalName = ""; var _controlName1 = "{Right}"; try { #region recordsinexcel string _controlValue = null; section = testData.Structure.Rows[0]["Section"].ToString(); // When to Create Data table for first time ? // if (System.IO.File.Exists(_reportsPath + uiAfileName + "Log.csv") == false) // { // uilog.AddHeaders(); // } for (int i = 0; i < testData.Structure.Rows.Count; i++) { uilog.AddHeaders(); uilog.createnewrow(); parentType = testData.Structure.Rows[i]["ParentType"].ToString(); parentSearchBy = testData.Structure.Rows[i]["ParentSearchBy"].ToString().ToLower(); parentSearchValue = testData.Structure.Rows[i]["ParentSearchValue"].ToString(); controlaction = testData.Structure.Rows[i]["ParentSearchValue"].ToString(); uilog.AddTexttoColumn("FunctionName", "AddData"); uilog.AddTexttoColumn("StructureSheetName", ptestDataPath); uilog.AddTexttoColumn("TestCaseID", ptestCase); uilog.AddTexttoColumn("ParentType", parentType); uilog.AddTexttoColumn("ParentSearchBy", parentSearchBy); uilog.AddTexttoColumn("ParentSearchValue", parentSearchValue); if (Convert.IsDBNull(testData.Structure.Rows[i]["FieldName"]) == false) { _logicalName = (string)testData.Structure.Rows[i]["FieldName"].ToString(); logTofile(_eLogPtah, "Read FieldName/Logical Name : " + _logicalName); uilog.AddTexttoColumn("FieldName", _logicalName); } if (_logicalName.Length > 0) { _controlValue = (string)testData.Data.Rows[0][_logicalName].ToString(); logTofile(_eLogPtah, "Logical Name: " + _logicalName + " Input Value : " + _controlValue); uilog.AddTexttoColumn("ControlValue", _controlValue); } logTofile(_eLogPtah, "******************* Section (Screen Name ) : " + section + "*************************************"); if ((string)testData.Structure.Rows[i]["inputdata"].ToString().ToLower() == "y") { if (Convert.IsDBNull(testData.Structure.Rows[i]["ParentType"]) == false) { if (!String.IsNullOrEmpty(_controlValue) || String.IsNullOrEmpty(_controlType)) { #region ConstructParent switch (parentType.Trim().ToLower()) { case "window": { try { /* wpfapp._application = _application; _globalWindow = wpfapp.GetWPFWindow(parentSearchValue); _globalWindow.Click(); * */ } catch (Exception ex) { logTofile(_eLogPtah, "[AddData]->[Window]: Execption was encountered" + ex.Message.ToString()); } break; } /* case "groupbox": { if (_immediateParent.Trim().ToLower() == "window") wpfapp.GetWPFGroupBox(_globalWindow, parentSearchBy, parentSearchValue); else wpfapp.GetWPFGroupBox(_globalGroup, parentSearchBy, parentSearchValue); break; } case "wpfmenu": { _globalMenu = wpfapp.GetWPFMenu(_globalWindow, parentSearchBy, parentSearchValue); _globalMenu.Click(); break; } */ case "uiautomationwindow": case "uwindow": { // if (uiAutomationWindow == null || uiAutomationWindow.Current.Name != parentSearchValue) if (uiAutomationWindow == null) { uiAutomationWindow = GetUIAutomationWindow(parentSearchBy, parentSearchValue); } else { uiAutomationCurrentParent = uiAutomationWindow; logTofile(_eLogPtah, "[AddData]->[uiautomationwindow]->UI automationwindow was already set " + uiAutomationWindow.Current.Name.ToString()); } break; } case "uiautomationchildwindow": case "uchildwindow": { uiAutomationCurrentParent = GetUIAutomationWindow(parentSearchBy, parentSearchValue); logTofile(_eLogPtah, "[AddData]->[uiautomationchildwindow]->UI automationchild window was already set " + uiAutomationCurrentParent.Current.Name.ToString()); break; } // case "uiautomationpane": // { // uiAutomationCurrentParent = GetUIAutomationPane(parentSearchBy, parentSearchValue); // break; // } case "commonhieararchy": { string parentH = ""; string parentHvalue = ""; string parentHSearchby = ""; testDataHieararchy.GetTestData(hrchyfile, parentSearchValue); # region HiearachySheet for (int ih = 0; ih < testDataHieararchy.Data.Rows.Count; ih++) { parentH = testDataHieararchy.Data.Rows[ih]["Parent"].ToString(); parentHvalue = testDataHieararchy.Data.Rows[ih]["Value"].ToString(); parentHSearchby = testDataHieararchy.Data.Rows[ih]["HSearchBy"].ToString(); switch (parentH.ToString().ToLower()) { case "uiautomationwindow": { if (uiAutomationWindow == null) { uiAutomationWindow = GetUIAutomationWindow(parentHSearchby, parentHvalue); } else { uiAutomationCurrentParent = uiAutomationWindow; logTofile(_eLogPtah, "[AddData]->[commonhieararchy]->[uiautomationwindow] : loaded with UIautomaiton window Value"); logTofile(_eLogPtah, "[AddData]->[commonhieararchy]->[uiautomationwindow] :UI automationwindow was already set and hehce Will not be Reloaded unless you force by some means:COMMONH"); } break; } case "uiautomationpane": { GetDescenDentPaneWithName(parentHvalue); break; } // this is used to junp to nth pane when no automation id or text was avaialable for panes. case "uiautomationchildpane": { GetChildPane(Int32.Parse(parentHvalue)); break; } } } # endregion HiearachySheet break; } case "uiautomationpane": case "upane": { if (_controlValue.Length > 0) { GetDescenDentPaneWithName(parentSearchValue); } break; } case "uiautomationchildpane": case "uchildpane": { GetChildPane(Int32.Parse(parentSearchValue)); break; } case "uiautomationtreeitem": case "utreeitem": { uiAutomationCurrentParent = GetUIAutomationtreeitem(parentSearchBy, parentSearchValue, -1); break; } default: throw new Exception("[AddData]:Not a valid parent type."); } #endregion ConstructParent } else { logTofile(_eLogPtah, "Parent is not constructed as control value is null"); } } var _action = ""; var _searchBy = ""; var _index = -1; var _controlName = ""; if (Convert.IsDBNull(testData.Structure.Rows[i]["ControlName"]) == false) { _controlName = (string)testData.Structure.Rows[i]["ControlName"]; uilog.AddTexttoColumn("ControlName", _controlName); } logTofile(_eLogPtah, "SearchValue of control has been read from datatable " + _controlName); try { if (Convert.IsDBNull(testData.Structure.Rows[i]["FrenchValue"]) == false) { _controlName1 = (string)testData.Structure.Rows[i]["FrenchValue"].ToString(); logTofile(_eLogPtah, "Read FrenchValue : " + _controlName1); } } catch { } if (Convert.IsDBNull(testData.Structure.Rows[i]["Action"]) == false) { _action = (string)testData.Structure.Rows[i]["Action"]; logTofile(_eLogPtah, "Action:" + _action); uilog.AddTexttoColumn("Action", _action); #region ActionColumn switch (_action.Trim().ToLower()) { case "drag": logTofile(_eLogPtah, "[Using drag action] "); string[] coord = _controlValue.Split(';'); string startCoordinate = coord[0]; string endCoordinate = coord[1]; clsCUIT_app app = new clsCUIT_app(); app._eLogPtah = _eLogPtah; app.Drag(startCoordinate, endCoordinate); uilog.AddTexttoColumn("Action Performed on Control", "Drag:"); break; case "autoitdrag": logTofile(_eLogPtah, "[Using autoit drag action]"); string[] coordinates = _controlValue.Split(';'); string startcoord = coordinates[0]; string endcoord = coordinates[1]; string[] start = startcoord.Split(','); string[] end = endcoord.Split(','); int x1 = Convert.ToInt32(start[0]); int y1 = Convert.ToInt32(start[1]); int x2 = Convert.ToInt32(end[0]); int y2 = Convert.ToInt32(end[1]); at.MouseClickDrag("Left", x1, y1, x2, y2, 10); uilog.AddTexttoColumn("Action Performed on Control", "AutoIt Drag"); break; case "keyboard": logTofile(_eLogPtah, "[Using Keyboard searching] " + _controlName); System.Windows.Forms.SendKeys.Flush(); logTofile(_eLogPtah, "Waiting for : " + _controlName); System.Windows.Forms.SendKeys.SendWait(_controlName); uilog.AddTexttoColumn("Action Performed on Control", "Sent Keystroke: Unconditional" + _controlName); break; case "condkeyboard": logTofile(_eLogPtah, "[Checking if Conditional Keyboard is to be used]"); if (_controlValue.Length > 0) { logTofile(_eLogPtah, "[Using Conditional Keyboard] " + _controlName); if (Convert.IsDBNull(testData.Structure.Rows[i]["Index"]) == false) { _index = Convert.ToInt32(testData.Structure.Rows[i]["Index"]); logTofile(_eLogPtah, " value of index " + _index); for (int j = 0; j < _index; j++) { System.Windows.Forms.SendKeys.Flush(); Console.WriteLine("Waiting for : " + _controlName); System.Windows.Forms.SendKeys.SendWait(_controlName); uilog.AddTexttoColumn("Action Performed on Control", "Sent Keystroke: conditional using index value" + _controlName); } } else { System.Windows.Forms.SendKeys.Flush(); Console.WriteLine("Waiting for : " + _controlName); System.Windows.Forms.SendKeys.SendWait(_controlName); uilog.AddTexttoColumn("Action Performed on Control", "Sent Keystroke: conditional not using index value" + _controlName); } } break; case "wait": logTofile(_eLogPtah, "[Waiting for ] " + _controlName); Console.WriteLine("Waiting for : " + _controlName); Thread.Sleep(int.Parse(_controlName) * 1000); uilog.AddTexttoColumn("Action Performed on Control", "Wait for " + _controlName + "Seconds"); break; case "conditionalwait": logTofile(_eLogPtah, "[Checking if Conditional wait is to be used]"); if (_controlValue.Length > 0) { logTofile(_eLogPtah, "[Using Conditional wait] " + _controlName); Console.WriteLine("Waiting for : " + _controlName); Thread.Sleep(int.Parse(_controlName) * 1000); uilog.AddTexttoColumn("Action Performed on Control", "Wait for " + _controlName + "Seconds"); } break; /* case "pagedown": Console.WriteLine("pagedown"); _globalWindow.Focus(); Thread.Sleep(1000); _globalWindow.Keyboard.PressSpecialKey(White.Core.WindowsAPI.KeyboardInput.SpecialKeys.PAGEDOWN); uilog.AddTexttoColumn("Action Performed on Control", "Pagedown"); break; */ /* case "pageup": _globalWindow.Focus(); _globalWindow.Keyboard.PressSpecialKey(White.Core.WindowsAPI.KeyboardInput.SpecialKeys.PAGEUP); break; */ case "refresh": break; case "clearwindow": // When we switch to a new UI automation window we must use "clear windo" in new structure sheet new window uiAutomationWindow = null; uilog.AddTexttoColumn("Action Performed on Control", "clearwindow"); break; default: logTofile(_eLogPtah, "[AddData]:Other Action than Specified Action: ---> " + _action.Trim().ToLower()); throw new Exception("Valid action types are keyboard, wait, pagedown, pageup"); } #endregion ActionColumn } if (Convert.IsDBNull(testData.Structure.Rows[i]["ControlType"]) == false) { _controlType = (string)testData.Structure.Rows[i]["ControlType"].ToString().ToLower(); // _logicalName = (string)testData.Structure.Rows[i]["FieldName"].ToString(); _searchBy = (string)testData.Structure.Rows[i]["SearchBy"]; Console.WriteLine(_logicalName); logTofile(_eLogPtah, "Field Name : =" + _logicalName); if (Convert.IsDBNull(testData.Structure.Rows[i]["Index"]) == false) { logTofile(_eLogPtah, "Trying to parse index for : " + _logicalName); _index = int.Parse(testData.Structure.Rows[i]["Index"].ToString()); logTofile(_eLogPtah, "Index was parsed. : " + _logicalName); } if (_logicalName.Length > 0) { _controlValue = (string)testData.Data.Rows[rowPosition][_logicalName].ToString(); } if (_logicalName.Length > 0 && _controlValue.Length == 0) { logTofile(_eLogPtah, "controlValue Length : " + _controlValue.Length); logTofile(_eLogPtah, "both Logical name was of 0 lenght and Control valuewas of 0 lenght :nothing doing !!!" + _logicalName); } else { #region ControlTypes uilog.AddTexttoColumn("ControlType", _controlType); switch (_controlType.Trim().ToLower()) { /* case "wpfmenuitem": wpfapp.GetWPFMenuItem(_globalMenu, _controlName).Click(); break; case "wpftoolstrip": wpfapp.GetWPFToolStrip(_globalWindow, _controlName).Focus(); break; case "wpflistbox": wpfapp.GetWPFListBox(_globalWindow, _searchBy, _controlName).Focus(); wpfapp.GetWPFListBox(_globalWindow, _searchBy, _controlName).Item(_controlValue).Select(); break; case "wpflabel": string labelName = wpfapp.GetWPFLabel(_globalWindow, _searchBy, _controlName).Text.ToString(); testData.UpdateTestData(testData.TestDataFile, testData.TestCase, _logicalName, labelName); break; */ case "uiautomationmenu": case "umenu": { if (_controlValue.Length > 0) { AutomationElement umenu = GetUIAutomationMenu(_searchBy, _controlName, _index); logTofile(_eLogPtah, "returned menu :" + umenu.Current.Name); ClickControl(umenu); Thread.Sleep(2000); } break; } case "uiautomationmenuitem": case "umenuitem": { if (_controlValue.Length > 0) { AutomationElement umenuitem = GetUIAutomationMenuItem(_searchBy, _controlName, _index); try { ClickControl(umenuitem); } catch (Exception ex) { logTofile(_eLogPtah, "Execption from click control was " + ex.Message.ToString()); logTofile(_eLogPtah, "Using Invoke Pattern for Menuitem alternately "); InvokePattern invkptn = (InvokePattern)umenuitem.GetCurrentPattern(InvokePattern.Pattern); invkptn.Invoke(); } } break; } case "umenuiteminvoke": { if (_controlValue.Length > 0) { AutomationElement umenuiteminvoke = GetUIAutomationMenuItem(_searchBy, _controlName, _index); string uname = umenuiteminvoke.Current.Name.ToString(); try { InvokePattern invkbuttonptn = (InvokePattern)umenuiteminvoke.GetCurrentPattern(InvokePattern.Pattern); logTofile(_eLogPtah, "Got the Invoke Pattern"); logTofile(_eLogPtah, "[AddData][uitem]: Menuitem will be clicked : " + _controlValue.ToString() + ":Times"); invkbuttonptn.Invoke(); System.Threading.Thread.Sleep(20); logTofile(_eLogPtah, "[AddData][uitem]:Clicked menuitem : " + uname); uilog.AddTexttoColumn("Action Performed on Control", "Invoke Pattern"); } catch { logTofile(_eLogPtah, "No Invoke Pattern hence using Click Control"); ClickControl(umenuiteminvoke); uilog.AddTexttoColumn("Action Performed on Control", "Invoke Pattern"); } } break; } case "uiautomationthumb": case "uthumb": { if (_controlValue.Length > 0) { AutomationElement uthumb = GetUIAutomationThumb(_searchBy, _controlName, _index); if (uthumb != null) { logTofile(_eLogPtah, "[Adddata]:[uiautomationthumb]:found control trying to double click it"); try { DoubleClickControl(uthumb); } catch (Exception ex) { logTofile(_eLogPtah, "[Adddata]:[uiautomationthumb] Error--.>" + ex.Message.ToString()); } } else { logTofile(_eLogPtah, "[Adddata]:[uiautomationthumb] thumb control Not found "); } } break; } case "uiautomationtext": case "utext": { if (_controlValue.Length > 0) { AutomationElement utext = GetUIAutomationText(_searchBy, _controlName, _index); switch (_controlValue.ToLower()) { case "1": ClickControl(utext); break; case "l": ClickControl(utext); break; case "r": RightClickControl(utext); break; case "d": DoubleClickControl(utext); break; default: Console.WriteLine("No valid input provided for clicking text"); break; } } break; } case "uiautomationimage": case "uimage": { if (_controlValue.Length > 0) { AutomationElement uimage = GetUIAutomationImage(_searchBy, _controlName, _index); switch (_controlValue.ToLower()) { case "1": ClickControl(uimage); break; case "l": ClickControl(uimage); break; case "r": RightClickControl(uimage); break; case "d": DoubleClickControl(uimage); break; default: Console.WriteLine("No valid input provided for clicking image"); break; } } break; } case "uiautomationdataitem": case "udataitem": { if (_controlValue.Length > 0) { logTofile(_eLogPtah, "control value : " + _controlValue); AutomationElement udtitem = GetUIAutomationDataItem(_searchBy, _controlName, _index); SelectionItemPattern selpat = (SelectionItemPattern)udtitem.GetCurrentPattern(SelectionItemPattern.Pattern); selpat.Select(); switch (_controlValue.ToLower()) { case "d": DoubleClickControl(udtitem); break; case "l": ClickControl(udtitem); break; case "r": RightClickControl(udtitem); break; case "1": ClickControl(udtitem); break; } } } break; case "uiautomationspinner": case "uspinner": { if (_controlValue.Length > 0) { logTofile(_eLogPtah, "control value:" + _controlValue); AutomationElement uspinner = GetUIAutomationSpinner(_searchBy, _controlName, _index); uspinner.SetFocus(); } } break; /* case "wpflistview": wpfapp.GetWPFDataGrid(_globalWindow, _searchBy, _controlName).Focus(); break; */ /* case "wpfcombobox": if (_controlValue.Length > 0) { wpfapp.GetWPFComboBox(_globalWindow, _searchBy, _controlName, _index).Select(_controlValue); uilog.AddTexttoColumn("Control Detected", "Yes"); uilog.AddTexttoColumn("Action Performed on Control", "select Combo item" + _controlValue); } break; */ case "uiautomationcombobox": case "ucombobox": bool itemClicked = false; AutomationElement combo = GetUIAutomationComboBox(_searchBy, _controlName, _index); try { combo.SetFocus(); ExpandCollapsePattern expandPat = (ExpandCollapsePattern)combo.GetCurrentPattern(ExpandCollapsePattern.Pattern); if (expandPat != null) { logTofile(_eLogPtah, "Expanding the combobox"); expandPat.Expand(); Thread.Sleep(100); } } catch { } //Click control was giving issue in K2, so added try catch try { ClickControl(combo); } catch { } System.Threading.Thread.Sleep(1000); //Control value is item to select AutomationElementCollection comboitems = combo.FindAll(TreeScope.Descendants, new System.Windows.Automation.PropertyCondition(AutomationElement.ControlTypeProperty, System.Windows.Automation.ControlType.ListItem)); logTofile(_eLogPtah, "[Adddata][uiautomationcombobox]:collection count was " + comboitems.Count); for (int icb = 0; icb <= comboitems.Count - 1; icb++) { if (comboitems[icb].Current.Name.ToLower() == _controlValue.ToLower()) //if listitemname matches { logTofile(_eLogPtah, "[Adddata][uiautomationcombobox]: Search By Name " + _controlValue.ToLower()); SelectionItemPattern selpat = (SelectionItemPattern)comboitems[icb].GetCurrentPattern(SelectionItemPattern.Pattern); logTofile(_eLogPtah, "[Adddata][uiautomationcombobox]:match found for -->" + _controlValue.ToLower()); selpat.Select(); uilog.AddTexttoColumn("Action Performed on Control", "List items matched using selection pattern"); break; } else if (_controlValue == icb.ToString()) //Index { logTofile(_eLogPtah, "[Adddata][uiautomationcombobox]: Search By Index " + _controlValue.ToLower()); SelectionItemPattern selpat = (SelectionItemPattern)comboitems[icb].GetCurrentPattern(SelectionItemPattern.Pattern); logTofile(_eLogPtah, "[Adddata][uiautomationcombobox]:match found for -->" + _controlValue.ToLower()); selpat.Select(); uilog.AddTexttoColumn("Action Performed on Control", "Selection done by index"); break; } else if (TreeWalker.ControlViewWalker.GetFirstChild(comboitems[icb]) != null) // Find by the text childnode of Listitem { AutomationElement elementNode = TreeWalker.ControlViewWalker.GetFirstChild(comboitems[icb]); string _controltype = elementNode.Current.LocalizedControlType.ToString(); logTofile(_eLogPtah, "[Adddata][uiautomationcombobox]: Search By Text inside ListItem " + elementNode.Current.Name.ToLower()); if (_controltype.ToLower() == "text" && elementNode.Current.Name.ToLower() == _controlValue.ToLower()) { logTofile(_eLogPtah, "[Adddata][uiautomationcombobox]: Match Found " + elementNode.Current.Name.ToLower()); try { ClickControl(elementNode); itemClicked = true; uilog.AddTexttoColumn("Action Performed on Control", "Text node selected using autoit " + _controlName); } catch { } if (itemClicked == false) { SelectionItemPattern selpat = (SelectionItemPattern)comboitems[icb].GetCurrentPattern(SelectionItemPattern.Pattern); if (selpat != null) { selpat.Select(); uilog.AddTexttoColumn("Action Performed on Control", "Text node selected using selection pattern " + _controlName); } } logTofile(_eLogPtah, "[Adddata][uiautomationcombobox]:match found for -->" + _controlValue.ToLower()); break; } } else { logTofile(_eLogPtah, "[Adddata][uiautomationcombobox]:no condtition matched for -->" + _controlValue.ToLower()); } } break; /* case "wpfcheckbox": if (_controlValue.Length > 0) { if (_controlValue.ToLower() == "on" || _controlValue.ToLower() == "1") { wpfapp.GetWPFCheckBox(_globalWindow, _searchBy, _controlName, _index).Select(); uilog.AddTexttoColumn("Control Detected", "Yes"); uilog.AddTexttoColumn("Action Performed on Control", "Check the checkbox :"); } else { wpfapp.GetWPFCheckBox(_globalWindow, _searchBy, _controlName, _index).UnSelect(); uilog.AddTexttoColumn("Control Detected", "Yes"); uilog.AddTexttoColumn("Action Performed on Control", "UnCheck the checkbox :"); } } break; */ case "uiautomationcheckbox": case "ucheckbox": logTofile(_eLogPtah, "Inside [uiautomationcheckbox]:"); if (_controlValue.Length > 0) { AutomationElement uiCheckBox = GetUIAutomationCheckBox(_searchBy, _controlName, _index); TogglePattern togPattern = (TogglePattern)uiCheckBox.GetCurrentPattern(TogglePattern.Pattern); ToggleState togstate = togPattern.Current.ToggleState; switch (_controlValue) { case "1": if (togstate == ToggleState.Off) { togPattern.Toggle(); } else logTofile(_eLogPtah, "Checkbox is already checked"); break; case "0": if (togstate == ToggleState.On) togPattern.Toggle(); else logTofile(_eLogPtah, "Checkbox is already unchecked"); break; case "c": ClickControl(uiCheckBox); break; default: logTofile(_eLogPtah, "Provide valid input for control value i.e. either 1 or 0"); break; } } else { logTofile(_eLogPtah, "Checkbox for " + _controlName + " need not be checked"); } break; case "uiautomationlistitem": case "ulistitem": logTofile(_eLogPtah, "Inside [uiautomationlistitem]:"); logTofile(_eLogPtah, "Control value length: " + _controlValue.Length); if (_controlValue.Length > 0) { AutomationElement uiListItem = GetUIAutomationListItem(_searchBy, _controlName, _index); TogglePattern togPattern = (TogglePattern)uiListItem.GetCurrentPattern(TogglePattern.Pattern); logTofile(_eLogPtah, "[Adddata][uiautomationlistitem]:match found for -->" + _controlValue.ToLower()); togPattern.Toggle(); } else { logTofile(_eLogPtah, "ListItem for " + _controlName + " need not be checked"); } break; case "codeduibutton": { clsCUIT_app app = new clsCUIT_app(); app._eLogPtah = _eLogPtah; WinButton winbutton = null; WinWindow win = app.GetCUITWindow(parentSearchBy, parentSearchValue); if (win == null) { logTofile(_eLogPtah, "Unable to find the window"); } if (_index == -1) { winbutton = app.GetCUITButton(win, _searchBy, _controlName, -1); } else { winbutton = app.GetCUITButton(win, _searchBy, _controlName, _index); } Playback.Initialize(); logTofile(_eLogPtah, "Inside [uiautomationlistitem]:"); Mouse.Click(winbutton); Playback.Cleanup(); break; } case "codeduidatarowheader": { clsCUIT_app app = new clsCUIT_app(); app._eLogPtah = _eLogPtah; WinRowHeader winrowheader = null; WinWindow win = app.GetCUITWindow(parentSearchBy, parentSearchValue); if (_index == -1) { winrowheader = app.GetCUITDataRowHeader(win, _searchBy, _controlName, -1); } else { winrowheader = app.GetCUITDataRowHeader(win, _searchBy, _controlName, _index); } Playback.Initialize(); logTofile(_eLogPtah, "Inside [uiautomationlistitem]:"); Mouse.Click(winrowheader); Playback.Cleanup(); break; } case "codeduidatacolumnheader": { clsCUIT_app app = new clsCUIT_app(); app._eLogPtah = _eLogPtah; WinColumnHeader wincolumnheader = null; WinWindow win = app.GetCUITWindow(parentSearchBy, parentSearchValue); if (_index == -1) { wincolumnheader = app.GetCUITDataColumnHeader(win, _searchBy, _controlName, -1); } else { wincolumnheader = app.GetCUITDataColumnHeader(win, _searchBy, _controlName, _index); } Playback.Initialize(); logTofile(_eLogPtah, "Inside [uiautomationlistitem]:"); Mouse.Click(wincolumnheader); Playback.Cleanup(); break; } case "codeduiradiobutton": { clsCUIT_app app = new clsCUIT_app(); app._eLogPtah = _eLogPtah; WinRadioButton radioButton = null; WinWindow win = app.GetCUITWindow(parentSearchBy, parentSearchValue); if (_index == -1) { radioButton = app.GetCUITRadioButton(win, _searchBy, _controlName, -1); } else { radioButton = app.GetCUITRadioButton(win, _searchBy, _controlName, _index); } Playback.Initialize(); logTofile(_eLogPtah, "Playback Initialized"); Mouse.Click(radioButton); Playback.Cleanup(); break; } case "codeduidatarow": { clsCUIT_app app = new clsCUIT_app(); app._eLogPtah = _eLogPtah; WinRow row = null; WinWindow win = app.GetCUITWindow(parentSearchBy, parentSearchValue); if (_index == -1) { row = app.GetCUITDataRow(win, _searchBy, _controlName, -1); } else { row = app.GetCUITDataRow(win, _searchBy, _controlName, _index); } Playback.Initialize(); logTofile(_eLogPtah, "Playback Initialized"); Playback.Cleanup(); break; } case "codeduidatacell": { clsCUIT_app app = new clsCUIT_app(); app._eLogPtah = _eLogPtah; WinCell cell = null; WinWindow win = app.GetCUITWindow(parentSearchBy, parentSearchValue); if (_index == -1) { cell = app.GetCUITDataCell(win, _searchBy, _controlName, -1); } else { cell = app.GetCUITDataCell(win, _searchBy, _controlName, _index); } Playback.Initialize(); logTofile(_eLogPtah, "Playback Initialized"); cell.Value = _controlValue; Playback.Cleanup(); break; } case "codeduimenuitem": { clsCUIT_app app = new clsCUIT_app(); app._eLogPtah = _eLogPtah; WinMenuItem menuItem = null; WinWindow win = app.GetCUITWindow(parentSearchBy, parentSearchValue); if (_index == -1) { menuItem = app.GetCUITMenuItem(win, _searchBy, _controlName, -1); } else { menuItem = app.GetCUITMenuItem(win, _searchBy, _controlName, _index); } Playback.Initialize(); logTofile(_eLogPtah, "Playback Initialized"); switch (_controlValue.ToLower()) { case "1": Mouse.Click(menuItem); break; case "r": Mouse.Click(menuItem, System.Windows.Forms.MouseButtons.Right); break; case "d": Mouse.DoubleClick(menuItem); break; default: Console.WriteLine("No valid input provided for clicking image"); break; } Mouse.DoubleClick(menuItem); Playback.Cleanup(); break; } case "codeduilistitem": { clsCUIT_app app = new clsCUIT_app(); app._eLogPtah = _eLogPtah; WinListItem listitem = null; WinWindow win = app.GetCUITWindow(parentSearchBy, parentSearchValue); if (_index == -1) { listitem = app.GetCUITListItem(win, _searchBy, _controlName, -1); } else { listitem = app.GetCUITListItem(win, _searchBy, _controlName, _index); } Playback.Initialize(); logTofile(_eLogPtah, "Playback Initialized"); Mouse.Click(listitem); Playback.Cleanup(); break; } case "codeduilist": { clsCUIT_app app = new clsCUIT_app(); app._eLogPtah = _eLogPtah; WinList list = null; WinWindow win = app.GetCUITWindow(parentSearchBy, parentSearchValue); if (_index == -1) { list = app.GetCUITList(win, _searchBy, _controlName, -1); } else { list = app.GetCUITList(win, _searchBy, _controlName, _index); } Playback.Initialize(); logTofile(_eLogPtah, "Playback Initialized"); int item = int.Parse(_controlValue); int[] selected = new int[1]; selected[0] = item - 1; list.SelectedIndices = selected; Playback.Cleanup(); break; } case "codeduitextcontrol": { clsCUIT_app app = new clsCUIT_app(); app._eLogPtah = _eLogPtah; WinText text = null; WinWindow win = app.GetCUITWindow(parentSearchBy, parentSearchValue); if (_index == -1) { text = app.GetCUITTextcontrol(win, _searchBy, _controlName, -1); } else { text = app.GetCUITTextcontrol(win, _searchBy, _controlName, _index); } Playback.Initialize(); logTofile(_eLogPtah, "Playback Initialized"); Mouse.Click(text); Playback.Cleanup(); break; } case "codeduitreeitem": { clsCUIT_app app = new clsCUIT_app(); app._eLogPtah = _eLogPtah; WinTreeItem treeItem = null; WinWindow win = app.GetCUITWindow(parentSearchBy, parentSearchValue); if (_index == -1) { treeItem = app.GetCUITTreeItem(win, _searchBy, _controlName, -1); } else { treeItem = app.GetCUITTreeItem(win, _searchBy, _controlName, _index); } Playback.Initialize(); logTofile(_eLogPtah, "Playback Initialized"); switch (_controlValue.ToLower()) { case "1": Mouse.Click(treeItem); break; case "r": Mouse.Click(treeItem, System.Windows.Forms.MouseButtons.Right); break; case "d": Mouse.DoubleClick(treeItem); break; default: Console.WriteLine("No valid input provided for clicking image"); break; } Playback.Cleanup(); break; } case "codeduicheckbox": { clsCUIT_app app = new clsCUIT_app(); app._eLogPtah = _eLogPtah; WinCheckBox checkBox = null; WinWindow win = app.GetCUITWindow(parentSearchBy, parentSearchValue); if (_index == -1) { checkBox = app.GetCUITCHeckbox(win, _searchBy, _controlName, -1); } else { checkBox = app.GetCUITCHeckbox(win, _searchBy, _controlName, _index); } Playback.Initialize(); logTofile(_eLogPtah, "Playback Initialized"); if (_controlValue == "0") { checkBox.Checked = false; } else { checkBox.Checked = true; } Playback.Cleanup(); break; } case "codeduitabpage": { clsCUIT_app app = new clsCUIT_app(); app._eLogPtah = _eLogPtah; WinTabPage tab = null; WinWindow win = app.GetCUITWindow(parentSearchBy, parentSearchValue); if (_index == -1) { tab = app.GetCUITTabpage(win, _searchBy, _controlName, -1); } else { tab = app.GetCUITTabpage(win, _searchBy, _controlName, _index); } Playback.Initialize(); logTofile(_eLogPtah, "Playback Initialized"); Mouse.Click(tab); logTofile(_eLogPtah, "Clicked Tab Page"); Playback.Cleanup(); break; } case "codeduiedit": { clsCUIT_app app = new clsCUIT_app(); app._eLogPtah = _eLogPtah; WinEdit edit = null; WinWindow win = app.GetCUITWindow(parentSearchBy, parentSearchValue); if (_index == -1) { edit = app.GetCUITEdit(win, _searchBy, _controlName, -1); } else { edit = app.GetCUITEdit(win, _searchBy, _controlName, _index); } Playback.Initialize(); logTofile(_eLogPtah, "Playback Initialized"); if (edit.Enabled) { edit.SetFocus(); edit.Text = _controlValue; } Playback.Cleanup(); break; } case "clickcordinates": { string[] coordinates; coordinates = _controlName.Split(','); AutoItX3Lib.AutoItX3 at1 = new AutoItX3Lib.AutoItX3(); int x1 = Convert.ToInt32(coordinates[0]); int y1 = Convert.ToInt32(coordinates[1]); at1.MouseClick("LEFT", x1, y1, 1); break; } case "codeduicombobox": { clsCUIT_app app = new clsCUIT_app(); app._eLogPtah = _eLogPtah; WinComboBox comboBox = null; WinWindow win = app.GetCUITWindow(parentSearchBy, parentSearchValue); if (_index == -1) { comboBox = app.GetCUITComboBox(win, _searchBy, _controlName, -1); } else { comboBox = app.GetCUITComboBox(win, _searchBy, _controlName, _index); } Playback.Initialize(); logTofile(_eLogPtah, "Playback Initialized"); int selectedIndex = int.Parse(_controlValue); comboBox.SelectedIndex = selectedIndex; Playback.Cleanup(); break; } case "uiautomationselectlistitem": case "uselectlistitem": case "ulistitemselect": logTofile(_eLogPtah, "Inside [uiautomationselectlistitem]:"); logTofile(_eLogPtah, "Control value length: " + _controlValue.Length); if (_controlValue.Length > 0) { AutomationElement uiListItem = GetUIAutomationListItem(_searchBy, _controlName, _index); SelectionItemPattern selpat = (SelectionItemPattern)uiListItem.GetCurrentPattern(SelectionItemPattern.Pattern); selpat.Select(); logTofile(_eLogPtah, "[Adddata][uiautomationselectlistitem]:match found for -->" + _controlValue.ToLower()); } else { logTofile(_eLogPtah, "ListItem for " + _controlName + " need not be selected"); } break; case "uiautomationclicklistitem": case "uclicklistitem": case "ulistitemclick": logTofile(_eLogPtah, "Inside [uiautomationclicklistitem]:"); logTofile(_eLogPtah, "Control value length: " + _controlValue.Length); if (_controlValue.Length > 0) { AutomationElement uiListItem = GetUIAutomationListItem(_searchBy, _controlName, _index); switch (_controlValue.ToLower()) { case "1": ClickControl(uiListItem); break; case "l": ClickControl(uiListItem); break; case "r": RightClickControl(uiListItem); break; case "d": DoubleClickControl(uiListItem); break; default: Console.WriteLine("No valid input provided for clicking image"); break; } logTofile(_eLogPtah, "[Adddata][uiautomationselectlistitem]:match found for -->" + _controlValue.ToLower()); } else { logTofile(_eLogPtah, "ListItem for " + _controlName + " need not be selected"); } break; case "uiautomationradiobutton": case "uradiobutton": if (_controlValue.ToLower().Equals("1")) { AutomationElement uiRadio = GetUIAutomationRadioButton(_searchBy, _controlName, _index); SelectionItemPattern selpat = (SelectionItemPattern)uiRadio.GetCurrentPattern(SelectionItemPattern.Pattern); logTofile(_eLogPtah, "[Adddata][uiautomationradiobutton]: match found for -->" + _controlValue.ToLower()); selpat.Select(); } else { logTofile(_eLogPtah, "Radio Button for " + _controlName + " need not be selected"); } break; /* case "wpfbutton": if (_controlValue.Length > 0) logTofile(_eLogPtah, "[AddData]:[wpfbutton]:Trying to Click Button:== " + _logicalName); { try { if (wpfapp.GetWPFButton(_globalWindow, _searchBy, _controlName, _index) != null) { uilog.AddTexttoColumn("Control Detected", "Yes"); } else { uilog.AddTexttoColumn("Control Detected", "No"); } wpfapp.GetWPFButton(_globalWindow, _searchBy, _controlName, _index).Click(); uilog.AddTexttoColumn("Action Performed on Control", "Click button [White method]: " + _controlName); logTofile(_eLogPtah, "[AddData]:[wpfbutton]:Trying to Clicked Button:== " + _logicalName); } catch (Exception ex) { logTofile(_eLogPtah, "Error in wpfbutton:" + ex.ToString()); } } break; */ case "splitterdropdown": logTofile(_eLogPtah, "Got Control type Splieeter"); logTofile(_eLogPtah, "SearchBy " + _searchBy + "Search value" + _controlName + "index" + _index); break; case "pvmaskedit": if (_controlValue.Length > 0) { AutomationElement uiPvMaskedit = GetUIAutomationPVMaskEdit(_searchBy, _controlName, _index); ClickControl(uiPvMaskedit); Thread.Sleep(2000); KeyBoardEnter(_controlValue); } else { logTofile(_eLogPtah, "Radio Button for " + _controlName + " need not be selected"); } break; case "pvcombobox": if (_controlValue.Length > 0) { AutomationElement uiPvCombo = GetUIAutomationbutton(_searchBy, _controlName, _index); ClickControl(uiPvCombo); Thread.Sleep(2000); Playback.Initialize(); WinWindow cmbwin = new WinWindow(); cmbwin.SearchProperties.Add(WinWindow.PropertyNames.Name, "ComboBox"); while (cmbwin.Exists == false) { ClickControl(uiPvCombo); Playback.Wait(2000); } Console.WriteLine("Combowin exists confirmed"); WinWindow listwin = new WinWindow(cmbwin); listwin.WindowTitles.Add("ComboBox"); listwin.SetFocus(); WinList flist = new WinList(listwin); flist.WindowTitles.Add("ComboBox"); Playback.Wait(2000); int ik = 0; while (flist.Exists == false) { Console.WriteLine("Clcik was not performed with enough strength: " + ik); ClickControl(uiPvCombo); Playback.Wait(2000); ik++; } Console.WriteLine("List obtained Confirmd"); AutomationElement ae = AutomationElement.RootElement; Condition cond = new System.Windows.Automation.AndCondition( new System.Windows.Automation.PropertyCondition(AutomationElement.ControlTypeProperty, System.Windows.Automation.ControlType.Window), new System.Windows.Automation.PropertyCondition(AutomationElement.NameProperty, "ComboBox", PropertyConditionFlags.IgnoreCase) ); AutomationElement cmbowin = ae.FindFirst(TreeScope.Descendants, cond); Condition cond2 = new System.Windows.Automation.PropertyCondition(AutomationElement.ControlTypeProperty, System.Windows.Automation.ControlType.DataItem); AutomationElementCollection alldataitems = cmbowin.FindAll(TreeScope.Descendants, cond2); Console.WriteLine("Got collection count =" + alldataitems.Count); foreach (AutomationElement inditem in alldataitems) { if (inditem.Current.Name == _controlValue) { InvokePattern invk = (InvokePattern)inditem.GetCurrentPattern(InvokePattern.Pattern); invk.Invoke(); break; } } // flist.SelectedItemsAsString = selvalue; Playback.Cleanup(); } else { logTofile(_eLogPtah, "Radio Button for " + _controlName + " need not be selected"); } break; /* case "wpfradiobutton": try { if (_controlValue.Length > 0) { if (wpfapp.GetWPFRadioButton(_globalWindow, _searchBy, _controlName, _index) != null) { uilog.AddTexttoColumn("Control Detected", "Yes"); } else { uilog.AddTexttoColumn("Control Detected", "No"); } wpfapp.GetWPFRadioButton(_globalWindow, _searchBy, _controlName, _index).Select(); uilog.AddTexttoColumn("Control Detected", "Yes"); uilog.AddTexttoColumn("Action Performed on Control", "selected Radio button:" + _controlName); Thread.Sleep(1000); } } catch (Exception ex) { uilog.AddTexttoColumn("Control Detected", "No"); logTofile(_eLogPtah, "[AddData][wpfradiobutton]: Could not Find Object with Given Search conditions in application." + ex.Message.ToString()); } break; case "wpftextbox": if (_controlValue != DBNull.Value.ToString()) { if (_globalWindow == null) { logTofile(_eLogPtah, "Add Data : Ooops Global window was got as Null !!!!"); } if (wpfapp.GetWPFTextBox(_globalWindow, _searchBy, _controlName, _index) != null) { uilog.AddTexttoColumn("Control Detected", "Yes"); } else { uilog.AddTexttoColumn("Control Detected", "No"); } wpfapp.GetWPFTextBox(_globalWindow, _searchBy, _controlName, _index).SetValue(_controlValue); uilog.AddTexttoColumn("Action Performed on Control", "Enter Value in TextBox :" + _controlValue); System.Windows.Forms.SendKeys.SendWait("{TAB}"); } break; /* case "wpfmultilinetextbox": logTofile(_eLogPtah, " [Add Data]->[wpfmultilinetextbox]-->looking for " + _logicalName); logTofile(_eLogPtah, " [Add Data]->[wpfmultilinetextbox]-->Global Parent " + _globalWindow.Name.ToString()); if (uiAutomationCurrentParent != null) { logTofile(_eLogPtah, " [AddData]->wpfmultileinetextbox uicurrent parent " + uiAutomationCurrentParent.Current.Name + " Automation Id" + uiAutomationCurrentParent.Current.AutomationId + "Control Type: " + uiAutomationCurrentParent.Current.ControlType.ToString() ); } else { logTofile(_eLogPtah, " [AddData]->wpfmultileinetextbox uicurrent parnet was still null "); } if (_controlValue != DBNull.Value.ToString()) { SearchCriteria _tbsearchcriteria = SearchCriteria.ByText(_controlName); { logTofile(_eLogPtah, " Function --> Add Data- >global window was not set ..trying to set it first "); // GetUIAutomationWindow(parentSearchBy, parentSearchValue); } try { var tbeditor = _globalWindow.Get<MultilineTextBox>(_tbsearchcriteria); if (tbeditor != null) { uilog.AddTexttoColumn("Control Detected", "Yes"); } else { uilog.AddTexttoColumn("Control Detected", "No"); } logTofile(_eLogPtah, "[AddData]->[wpfmultileinetextbox] : chekcing if this editor box is enabled or no " + tbeditor.Enabled); // if (tbeditor.Enabled==true) // { tbeditor.Click(); System.Windows.Forms.SendKeys.Flush(); System.Windows.Forms.SendKeys.SendWait("{HOME}"); System.Windows.Forms.SendKeys.Flush(); System.Windows.Forms.SendKeys.SendWait("+{END}"); System.Windows.Forms.SendKeys.Flush(); System.Windows.Forms.SendKeys.SendWait("{DEL}"); // } // *************Clear all vlaues ======================== // *************Clear all vlaues ======================== if (tbeditor != null) { logTofile(_eLogPtah, "[AddData]->[wpfmultileinetextbox] : multileline textbox "); } else { logTofile(_eLogPtah, "[AddData]->[wpfmultileinetextbox] : Error in detecting multilline textbox: "); } tbeditor.Text = _controlValue; logTofile(_eLogPtah, "[AddData]->[wpfmultileinetextbox] : Trying to input on data editor "); if (tbeditor.Text != _controlValue) { logTofile(_eLogPtah, "[AddData]->[wpfmultileinetextbox] Error in inputing Data data was Not input properly by white "); } uilog.AddTexttoColumn("Action Performed on Control", "Enter Value in TextBoxmulti (WPF) :" + _controlValue); } catch (Exception ex) { logTofile(_eLogPtah, " [AddData]->[wpfmultileinetextbox] Error retriving WPfmultilene textbox " + ex.Message.ToString()); } } break; */ case "maskedwpftextbox": logTofile(_eLogPtah, " Inside->[maskedwpftextbox] "); AutomationElement maskeditbox = GetUIAutomationEdit(_searchBy, _controlName, _index); logTofile(_eLogPtah, "Obtained the maskedit box"); logTofile(_eLogPtah, "bonding rec value" + maskeditbox.Current.BoundingRectangle.Y.ToString()); ValuePattern editval1 = (ValuePattern)maskeditbox.GetCurrentPattern(ValuePattern.Pattern); editval1.SetValue(""); editval1.SetValue(_controlValue); break; case "uiautomationedit": case "uedit": AutomationElement editbox = GetUIAutomationEdit(_searchBy, _controlName, _index); if (editbox != null) { logTofile(_eLogPtah, "[AddData]->[uiautomationedit]:-> controlname " + _controlName + " was found "); } else { logTofile(_eLogPtah, "[AddData]->[uiautomationedit]:-> controlname " + _controlName + " was NOT found "); } if (_controlValue != null) { try { editbox.SetFocus(); } catch (Exception ex) { logTofile(_eLogPtah, "[AddData]->[uiautomationedit]:-setfocus issue encoutered " + ex.Message.ToString()); } } logTofile(_eLogPtah, "[AddData]->[uiautomationedit]:- Searching for Value Pattern"); ValuePattern editval = null; try { editval = (ValuePattern)editbox.GetCurrentPattern(ValuePattern.Pattern); logTofile(_eLogPtah, "[AddData]->[uiautomationedit]:- Value Pattern found"); editval.SetValue(_controlValue); uilog.AddTexttoColumn("Action Performed on Control", "Entered Value: [Value Pattern]" + _controlValue); } catch { if (editval == null) //no value pattern found { logTofile(_eLogPtah, "[AddData]->[uiautomationedit]:- Value Pattern not found"); ClickControl(editbox); System.Windows.Forms.SendKeys.Flush(); System.Windows.Forms.SendKeys.SendWait(_controlValue); } } logTofile(_eLogPtah, "[AddData]->[uiautomationedit]:- Value entered successfully"); break; case "uiautomationtextarea": case "utextarea": AutomationElement textarea = GetUIAutomationTextarea(_searchBy, _controlName, _index); if (textarea != null) { logTofile(_eLogPtah, "[AddData]->[uiautomationtextarea]:-> controlname " + _controlName + " was found "); } else { logTofile(_eLogPtah, "[AddData]->[uiautomationtextarea]:-> controlname " + _controlName + " was NOT found "); } if (_controlValue != null) { try { if (textarea.Current.IsKeyboardFocusable == true) { textarea.SetFocus(); } try { ClickControl(textarea); } catch (Exception ex) { logTofile(_eLogPtah, "[AddData]->[uiautomationtextarea]:-Clickble epoints issue: " + ex.Message.ToString()); } } catch (Exception ex) { logTofile(_eLogPtah, "[AddData]->[uiautomationtextarea]:-setfocus issue encoutered " + ex.Message.ToString()); } } if (textarea.Current.IsEnabled == true) { TextPattern txtptn = (TextPattern)textarea.GetCurrentPattern(TextPattern.Pattern); // following loop is just to ensure that values are entered correctly in textbox. string rtt = txtptn.DocumentRange.GetText(10000); do { System.Windows.Forms.SendKeys.Flush(); System.Windows.Forms.SendKeys.SendWait("{HOME}"); System.Windows.Forms.SendKeys.Flush(); System.Windows.Forms.SendKeys.SendWait("+{END}"); System.Windows.Forms.SendKeys.Flush(); System.Windows.Forms.SendKeys.SendWait("{DEL}"); System.Windows.Forms.SendKeys.SendWait(_controlValue); txtptn = (TextPattern)textarea.GetCurrentPattern(TextPattern.Pattern); rtt = txtptn.DocumentRange.GetText(10000); logTofile(_eLogPtah, "checking for value " + rtt.ToString()); } while (rtt != _controlValue); } else { logTofile(_eLogPtah, "Target TextBox is not enabled for entering data"); } uilog.AddTexttoColumn("Action Performed on Control", "Enter Value: using keystrokes " + _controlValue); break; case "uiautomationcustominvokecontrol": case "ucustominvokecontrol": case "ucustominvoke": logTofile(_eLogPtah, "[AddData]->[uiautomationcustominvokecontrol] ControlValue" + _controlName + " : Length is " + _controlName.Length); AutomationElement customcontrol = GetUIAutomationCustominvokecontrol(_searchBy, _controlName, _index); try { InvokePattern invkptn = (InvokePattern)customcontrol.GetCurrentPattern(InvokePattern.Pattern); if (_controlValue.ToLower() == "y" || _controlValue == "1") { invkptn.Invoke(); uilog.AddTexttoColumn("Action Performed on Control", "Invoke:"); } } catch (Exception ex) { uilog.AddTexttoColumn("Action Performed on Control", "Failed in Invoke:"); logTofile(_eLogPtah, "[AddData]->[uiautomationcustominvokecontrol]" + ex.Message.ToString()); } break; case "uiautomationcustomclickcontrol": case "ucustomclickcontrol": AutomationElement customclickcontrol = GetUIAutomationCustominvokecontrol(_searchBy, _controlName, _index); try { if (_controlValue.Length > 0) { switch (_controlValue.ToLower()) { case "l": case "1": ClickControl(customclickcontrol); break; case "r": RightClickControl(customclickcontrol); break; case "d": DoubleClickControl(customclickcontrol); break; default: Console.WriteLine("No valid input provided for clicking customclickcontrol"); break; } } } catch (Exception ex) { logTofile(_eLogPtah, "[AddData]->[uiautomationcustomclickcontrol]" + ex.Message.ToString()); } break; case "uiautomationcustomvaluecontrol": case "ucustomvaluecontrol": AutomationElement customvaluecontrol1 = GetUIAutomationCustomvaluecontrol(_searchBy, _controlName, _index); if (customvaluecontrol1 != null) { logTofile(_eLogPtah, "[AddData]->[uiautomationcustomvaluecontrol] Control was found "); } else { logTofile(_eLogPtah, "[AddData]->[uiautomationcustomvaluecontrol] Control was NOt found "); } try { ValuePattern invkptn = (ValuePattern)customvaluecontrol1.GetCurrentPattern(ValuePattern.Pattern); invkptn.SetValue(_controlValue); } catch (Exception ex) { logTofile(_eLogPtah, "[AddData]->[uiautomationcustomvaluecontrol]" + ex.Message.ToString()); } break; case "uiautomationcustomrightclickcontrol": case "ucustomrightclickcontrol": AutomationElement customcontrolrightclick = GetUIAutomationCustominvokecontrol(_searchBy, _controlName, _index); if (customcontrolrightclick != null) { logTofile(_eLogPtah, "[AddData]->[uiautomationcustomrightclickcontrol] Control was found "); try { RightClickControl(customcontrolrightclick); } catch (Exception ex) { logTofile(_eLogPtah, "[AddData]->[uiautomationcustomrightclickcontrol]" + ex.Message.ToString()); } } else { logTofile(_eLogPtah, "[AddData]->[uiautomationcustomrightclickcontrol] Control was NOt found "); } break; case "uiautomationultratabitem": case "uultratabitem": case "utabitem": AutomationElement ultratabitem = GetUIAutomationUltratab(_searchBy, _controlName, _index); logTofile(_eLogPtah, "[AddData]->[uiautomationultratabitem] Ultra Tab Name" + ultratabitem.Current.Name); AutomationElement objbuttonnext = null; if (objbuttonnext == null) { try { if (ultratabitem.Current.IsKeyboardFocusable == true) { ultratabitem.SetFocus(); } ClickControl(ultratabitem); uilog.AddTexttoColumn("Action Performed on Control", "Click Object: Autoit " + _controlName); logTofile(_eLogPtah, "Clicked the ultratabitem using clickcontrol "); } catch (Exception e) { SelectionItemPattern selpat = (SelectionItemPattern)ultratabitem.GetCurrentPattern(SelectionItemPattern.Pattern); selpat.Select(); uilog.AddTexttoColumn("Action Performed on Control", "Click Object: Select Pattern (from Catch block) " + _controlName); logTofile(_eLogPtah, "Clicked using Selection Pattern " + e.Message); } } else // need to detect until no error { try { ClickControl(ultratabitem); } catch (Exception e) { SelectionItemPattern selpat = (SelectionItemPattern)ultratabitem.GetCurrentPattern(SelectionItemPattern.Pattern); selpat.Select(); logTofile(_eLogPtah, "Catch block " + e.Message); logTofile(_eLogPtah, "Clicked using Selection Pattern "); } } break; case "uiautomationselectultratabitem": case "uselectultratabitem": AutomationElement ultratabitemSelect = GetUIAutomationUltratab(_searchBy, _controlName, _index); logTofile(_eLogPtah, "[AddData]->[uiautomationselectultratabitem] Ultra Tab Name" + ultratabitemSelect.Current.Name); try { if (ultratabitemSelect.Current.IsKeyboardFocusable == true) { ultratabitemSelect.SetFocus(); } SelectionItemPattern selpat = (SelectionItemPattern)ultratabitemSelect.GetCurrentPattern(SelectionItemPattern.Pattern); selpat.Select(); uilog.AddTexttoColumn("Action Performed on Control", "Clicked using Selection Pattern " + _controlName); logTofile(_eLogPtah, "Clicked using Selection Pattern "); } catch (Exception e) { logTofile(_eLogPtah, "Error encountered in uiautomationselectultratabitem: " + e.Message); throw new Exception("uiautomationselectultratabitem" + e.Message); } break; case "uiautomationbutton": case "ubutton": if (_controlValue.Length > 0) { if (uiAutomationWindow.Current.Name.Length == 0) { uiAutomationWindow = GetUIAutomationWindow(parentSearchBy, parentSearchValue); } AutomationElement button = GetUIAutomationbutton(_searchBy, _controlName, _index); string bname = button.Current.Name.ToString(); logTofile(_eLogPtah, "[AddData][uiautomationbutton]:Retrived button contol : " + bname); logTofile(_eLogPtah, "Clicking the button using Invoke pattern"); try { InvokePattern invkbuttonptn = (InvokePattern)button.GetCurrentPattern(InvokePattern.Pattern); logTofile(_eLogPtah, "Got the Invoke Pattern"); if (Convert.IsDBNull(_controlValue) == false) if (Int32.Parse(_controlValue) > 0) { logTofile(_eLogPtah, "[AddData][uiautomationbutton]: Button will be clicked : " + _controlValue.ToString() + ":Times"); for (int ib = 0; ib < Int32.Parse(_controlValue); ib++) { invkbuttonptn.Invoke(); System.Threading.Thread.Sleep(20); logTofile(_eLogPtah, "[AddData][uiautomationbutton]:Clicked button : " + bname + "Times:" + ib.ToString()); } } uilog.AddTexttoColumn("Action Performed on Control", "Invoke Pattern"); } catch { logTofile(_eLogPtah, "No Invoke Pattern hence using Click Control"); ClickControl(button); uilog.AddTexttoColumn("Action Performed on Control", "Invoke Pattern"); } } break; case "uiautomationtogglebutton": case "utogglebutton": logTofile(_eLogPtah, "Inside [uiautomationtogglebutton]:"); if (_controlValue.Length > 0) { AutomationElement uiTogbutton = GetUIAutomationbutton(_searchBy, _controlName, _index); TogglePattern togPattern = (TogglePattern)uiTogbutton.GetCurrentPattern(TogglePattern.Pattern); ToggleState togstate = togPattern.Current.ToggleState; switch (_controlValue) { case "1": if (togstate == ToggleState.Off) togPattern.Toggle(); else logTofile(_eLogPtah, "Button is already in On state"); break; case "0": if (togstate == ToggleState.On) togPattern.Toggle(); else logTofile(_eLogPtah, "Button is already in Off state"); break; default: logTofile(_eLogPtah, "Provide valid input for control value i.e. either 1 or 0"); break; } } else { logTofile(_eLogPtah, "Button for " + _controlName + " need not be clicked"); } break; case "uiautomationribbonbutton": case "uribbonbutton": if (uiAutomationWindow.Current.Name.Length == 0) { uiAutomationWindow = GetUIAutomationWindow(parentSearchBy, parentSearchValue); } AutomationElement ribbonbutton = GetUIAutomationRibbonButton(_searchBy, _controlName, _index); logTofile(_eLogPtah, "[AddData][uiautomationribbonbutton]:Retrived Ribbonbutton contol"); ClickControl(ribbonbutton); uilog.AddTexttoColumn("Action Performed on Control", "Click Control using autoit"); System.Threading.Thread.Sleep(20); logTofile(_eLogPtah, "[AddData][uiautomationribbonbutton]:Pressed Ribbonbutton : " + _logicalName); break; case "uiautomationtreeitemclick": case "utreeitemclick": if (_controlValue.Length > 0) { _controlName = _controlValue; } AutomationElement treeitem = GetUIAutomationtreeitem(_searchBy, _controlName, _index); ClickControl(treeitem); uilog.AddTexttoColumn("Action Performed on Control", "Click Tree item with text: " + _controlName); break; case "uiautomationtreeitem": case "utreeitem": { if (_controlValue.Length > 0) { AutomationElement treeviewitem = GetUIAutomationtreeitem(_searchBy, _controlName, _index); switch (_controlValue.ToLower()) { case "l": ClickControl(treeviewitem); break; case "r": RightClickControl(treeviewitem); break; case "d": DoubleClickControl(treeviewitem); break; default: Console.WriteLine("No valid input provided for clicking treeitem"); break; } } break; } //this method is used for both expanding and collapsing the Tree nnodes case "uiautomationtreeitemexpand": case "utreeitemexpand": if (_controlValue.Length > 0) { _controlName = _controlValue; } AutomationElement treeitemcolapsed = GetUIAutomationtreeitem(_searchBy, _controlName, _index); DoubleClickControl(treeitemcolapsed); break; case "uiautomationtreeitemexpandk2": case "utreeitemexpandk2": if (_controlValue.Length > 0) { AutomationElement treeviewitem = GetUIAutomationtreeitem(_searchBy, _controlName, _index); ExpandCollapsePattern collapsepat = (ExpandCollapsePattern)treeviewitem.GetCurrentPattern(ExpandCollapsePattern.Pattern); ExpandCollapseState state = collapsepat.Current.ExpandCollapseState; if (state == ExpandCollapseState.Collapsed || state == ExpandCollapseState.PartiallyExpanded) { collapsepat.Expand(); logTofile(_eLogPtah, "Tree item expanded"); } else logTofile(_eLogPtah, " tree item is already expanded"); } break; case "uiautomationtreeitemcollapsek2": case "utreeitemcollapsek2": if (_controlValue.Length > 0) { AutomationElement treeviewitem = GetUIAutomationtreeitem(_searchBy, _controlName, _index); ExpandCollapsePattern expandpat = (ExpandCollapsePattern)treeviewitem.GetCurrentPattern(ExpandCollapsePattern.Pattern); ExpandCollapseState state = expandpat.Current.ExpandCollapseState; if (state == ExpandCollapseState.Expanded) { expandpat.Collapse(); logTofile(_eLogPtah, "Tree item collapsed"); } else logTofile(_eLogPtah, " tree item is already collapsed"); } break; case "uiautomationsyncfusionpane": case "usyncfusionpane": AutomationElement syncfusionpane = GetUIAutomationsyncfusionpane(_searchBy, _controlName, _index); // syncfusionpane.SetFocus();this mehtod dud not work hence using clickable point logTofile(_eLogPtah, "Datagrid : " + syncfusionpane.Current.Name); Console.WriteLine("[AddData][uiautomationsyncfusionpane]:-->before trying getclick"); ClickControl(syncfusionpane); uilog.AddTexttoColumn("Action Performed on Control", "Click object"); if (_controlValue != null) { char[] celldellim = new char[] { '|' }; string[] arrcelladd = _controlValue.Split(celldellim); foreach (var item in arrcelladd) { // split control value in an array char[] delim = new char[] { ';' }; string[] arr = item.Split(delim); string rowval = arr[0]; string colval = arr[1]; string offsetval = arr[2]; string dataval = arr[3]; if (_controlName1.ToLower() != "{tab}" && _controlName1.ToLower() != "{right}") System.Console.WriteLine("uiautomationsyncfusionpane]->Wrong value in French value column of structure sheet"); setcellvaleps(rowval, colval, offsetval, dataval, _controlName1); } } break; case "uiautomationsyncfusionpanereo": case "usyncfusionpanereo": AutomationElement syncfusionpanereo = GetUIAutomationsyncfusionpane(_searchBy, _controlName, _index); // syncfusionpane.SetFocus();this mehtod dud not work hence using clickable point logTofile(_eLogPtah, "Datagrid : " + syncfusionpanereo.Current.Name); Console.WriteLine("[AddData][uiautomationsyncfusionpane]:-->before trying getclick"); //ClickControl(syncfusionpanereo); if (_controlValue != null) { char[] celldellim = new char[] { '|' }; string[] arrcelladd = _controlValue.Split(celldellim); foreach (var item in arrcelladd) { // split control value in an array char[] delim = new char[] { ';' }; string[] arr = item.Split(delim); string rowval = arr[0]; string colval = arr[1]; string offsetval = arr[2]; string dataval = arr[3]; if (_controlName1.ToLower() != "{tab}" && _controlName1.ToLower() != "{right}") System.Console.WriteLine("uiautomationsyncfusionpane]->Wrong value in French value column of structure sheet"); setcellvaleps(rowval, colval, offsetval, dataval, _controlName1); } } break; case "uiautomationinfratable": case "uinfratable": AutomationElement infratable = GetUIAutomationInfraTableFlat(_searchBy, _controlName, _index); // syncfusionpane.SetFocus();this mehtod dud not work hence using clickable point Console.WriteLine("[AddData][uiautomationsyncfusionpane]:-->before trying getclick"); ClickControl(infratable); break; case "uiainfratablerow": case "uinfratablerow": if (Convert.IsDBNull(_controlName) == true || _controlName == "") { _controlName = _controlValue; logTofile(_eLogPtah, "[AddData]->[uiainfratablerow]: triyng to find infra row"); AutomationElement infratablerow = GetUIAutomationGroupInfraTableRow(_searchBy, _controlName, _index); InvokePattern pat = (InvokePattern)infratablerow.GetCurrentPattern(InvokePattern.Pattern); logTofile(_eLogPtah, "[AddData]->[uiainfratablerow]:found row now ...trying invoke patterns "); pat.Invoke(); } else { System.Console.WriteLine("[AddData]->[uiainfratablerow]->Arguments,controlname shud be blank but has value " + _controlName); } break; case "uiainfratablerowflat": case "uinfratablerowflat": if (Convert.IsDBNull(_controlName) == true || _controlName == "") { _controlName = _controlValue; logTofile(_eLogPtah, "[AddData]->[uiainfratablerowflat] triyng to find infra row"); AutomationElement infratablerow = GetUIAutomationFlatInfraTableRow(_searchBy, _controlName, _index); InvokePattern pat = (InvokePattern)infratablerow.GetCurrentPattern(InvokePattern.Pattern); logTofile(_eLogPtah, "[AddData]->[uiainfratablerowflat] found row now ...trying invoke patterns "); pat.Invoke(); } else { System.Console.WriteLine("[AddData]->[uiainfratablerowflat]: ->Arguments,controlname shud be blank but has value " + _controlName); } break; case "uiainfratablerowflatnumber": case "uinfratablerowflatnumber": if (Convert.IsDBNull(_controlName) == true || _controlName == "") { _controlName = _controlValue; logTofile(_eLogPtah, "[AddData]->[uiainfratablerowflatnumber] triyng to find infra row"); if (Convert.ToInt32(_index) != 1) { AutomationElement infratablerow = GetUIAutomationFlatInfraTableRowByNumber(_searchBy, _controlName, _index); logTofile(_eLogPtah, "[AddData]->[uiainfratablerowflatnumbers] found row with index as " + _controlName); InvokePattern pat = (InvokePattern)infratablerow.GetCurrentPattern(InvokePattern.Pattern); logTofile(_eLogPtah, "[AddData]->[uiainfratablerowflatnumbers] found row now ...trying invoke patterns "); pat.Invoke(); } System.Windows.Forms.SendKeys.Flush(); System.Windows.Forms.SendKeys.SendWait("{Down}"); System.Windows.Forms.SendKeys.Flush(); System.Windows.Forms.SendKeys.SendWait("{Up}"); } else { System.Console.WriteLine("[AddData]->[uiainfratablerowflat]: ->Arguments,controlname shud be blank but has value " + _controlName); } break; /* case "wpfdatepicker": if (_controlValue != DBNull.Value.ToString()) { wpfapp.GetWPFDatePicker(_globalWindow, _searchBy, _controlName).SetValue(_controlValue); } break; case "wpftabitem": if (_controlValue != DBNull.Value.ToString()) { wpfapp.GetWPFTabItem(_globalWindow, _searchBy, _controlName).Select(); } break; case "wpftree": if (_controlValue != DBNull.Value.ToString()) { wpfapp.GetWPFTreeViewWindow(_globalWindow, _searchBy, _controlName, _index).SetValue(_controlValue); } break; */ case "uiautomationheader": case "uheader": if (_controlValue != DBNull.Value.ToString()) { AutomationElement header1 = GetUIAutomationHeader(_searchBy, _controlName, _index); try { InvokePattern hinvoke = (InvokePattern)header1.GetCurrentPattern(InvokePattern.Pattern); hinvoke.Invoke(); } catch (Exception e) { logTofile(_eLogPtah, "Execption" + e.Message.ToString()); } } break; case "uiautomationheaderitem": case "uheaderitem": if (_controlValue != DBNull.Value.ToString()) { AutomationElement headeritem = GetUIAutomationHeaderitem(_searchBy, _controlName, _index); try { switch (_controlValue.ToLower()) { case "1": ClickControl(headeritem); break; case "l": ClickControl(headeritem); break; case "r": RightClickControl(headeritem); break; case "d": DoubleClickControl(headeritem); break; default: Console.WriteLine("No valid input provided for clicking headeritem"); break; } } catch (Exception e) { logTofile(_eLogPtah, "Execption" + e.Message.ToString()); } } break; case "uicustomcalendarmatbal": { if (_controlValue.Length > 0) { AutomationElement showcalbutton = GetUIAutomationbutton(_searchBy, _controlName, _index); inputDateInCalendarControl1(showcalbutton, _controlValue); } break; } default: throw new Exception("[AddData]->[System.Windows.Automation.ControlType]:Not a valid control type."); } #endregion ControlTypes } } } uilog.commitrow(); uilog.CreateCSVfile(_reportsPath, uiAfileName); uilog.ClearDataTable(); } #endregion recordsinexcel } catch (Exception ex) { //todo add logging comments logTofile(_eLogPtah, "Erroring Line number in [Adddata] " + GetStacktrace(ex).ToString()); throw new Exception(_error + "[AddData]:" + System.Environment.NewLine + ex.Message); } }
public static void ClickListViewToEmpty(string name, string data) { WinWindow window = new WinWindow(); window.SearchProperties[WinWindow.PropertyNames.Name] = name; window.WindowTitles.Add("Task Type"); WinList list = new WinList(window); list.SelectedItemsAsString = null; }
public static void ClickListViewByValue(string name, string data) { WinWindow window = new WinWindow(); window.SearchProperties[WinWindow.PropertyNames.Name] = name; WinList list = new WinList(window); list.WindowTitles.Add("Task Type"); if (data == string.Empty) { Mouse.Click(list); } else { list.SelectedItemsAsString = data; } }
public static void AssertListViewByValue(string name, string[] data) { WinWindow window = new WinWindow(); window.SearchProperties[WinWindow.PropertyNames.Name] = name; WinList list = new WinList(window); list.WindowTitles.Add("Task Type"); UITestControlCollection collection = list.Items; for (int i = 0; i < collection.Count; i++) { Assert.AreEqual(data[i], collection[i].Name); } }
public void MOPAddWellStatusWin(string ComboBox, string CBValue, string WellName) { WinWindow MOPAddWellStatWin = new WinWindow(); MOPAddWellStatWin.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); MOPAddWellStatWin.SearchProperties.Add(WinWindow.PropertyNames.ClassName, "#32770"); MOPAddWellStatWin.SearchProperties.Add(WinWindow.PropertyNames.Name, "Add Well Status/MOP/Type History to Selected Well"); #region CB switch (ComboBox) { case "NewStatus": { WinWindow NewStatusComboWin = new WinWindow(MOPAddWellStatWin); NewStatusComboWin.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); NewStatusComboWin.SearchProperties.Add(WinWindow.PropertyNames.ControlName, "combo"); NewStatusComboWin.SearchProperties.Add(WinWindow.PropertyNames.Instance, "3"); // New Status CB NewStatusComboWin.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well"); WinComboBox NewStatusComboBox = NewStatusComboWin.GetChildren().OfType<WinComboBox>().First(); WinWindow ComboBoxWindow = new WinWindow(); ComboBoxWindow.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); ComboBoxWindow.SearchProperties[WinWindow.PropertyNames.Name] = "ComboBox"; ComboBoxWindow.SearchProperties.Add(new PropertyExpression(WinWindow.PropertyNames.ClassName, "WindowsForms10.Window", PropertyExpressionOperator.Contains)); ComboBoxWindow.WindowTitles.Add("ComboBox"); WinWindow UIListWin = new WinWindow(ComboBoxWindow); UIListWin.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); UIListWin.SearchProperties[WinWindow.PropertyNames.ControlName] = "list"; UIListWin.WindowTitles.Add("ComboBox"); if (NewStatusComboBox.SelectedItem != CBValue) { //Mouse.Click(NewStatusComboBox); // NewStatusComboBox.Expanded = true; //WinList List = new WinList(UIListWin); //List.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); //List.WindowTitles.Add("ComboBox"); //string[] Items = List.SelectedItems; //foreach (string item in Items) //{ // if (item == CBValue) // { // WinListItem ItemToClick = new WinListItem(UIListWin); // ItemToClick.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); // ItemToClick.SearchProperties.Add(WinListItem.PropertyNames.Name, item); // Mouse.Click(ItemToClick); // } //} while (NewStatusComboBox.SelectedItem != CBValue) { Mouse.Click(NewStatusComboBox); Trace.WriteLine("Clicked Status Combo Box"); //NewStatusComboBox.Expanded = true; //Trace.WriteLine("Expanded Status Combo Box"); System.Threading.Thread.Sleep(5000); WinList List = new WinList(UIListWin); List.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); List.WindowTitles.Add("ComboBox"); WinListItem Item = new WinListItem(UIListWin); Item.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); Item.SearchProperties.Add(WinListItem.PropertyNames.Name, CBValue); if (UIListWin.Exists && Item.Exists) { // List.SelectedItemsAsString = CBValue; Mouse.Hover(Item); Trace.WriteLine("Mouse Hover on item " + Item); //System.Threading.Thread.Sleep(3000); Mouse.DoubleClick(Item); Trace.WriteLine("Double Click " + Item); } } } Assert.IsTrue(NewStatusComboBox.SelectedItem == CBValue, "Combox value : " + NewStatusComboBox.SelectedItem.ToString() + " Does NOT EQUAL " + CBValue + " the correct item was not set"); break; } case "MOP": { WinWindow NewStatusComboWin = new WinWindow(MOPAddWellStatWin); NewStatusComboWin.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); NewStatusComboWin.SearchProperties.Add(WinWindow.PropertyNames.ControlName, "combo"); NewStatusComboWin.SearchProperties.Add(WinWindow.PropertyNames.Instance, "2"); // MOP CB NewStatusComboWin.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well"); WinComboBox NewStatusComboBox = NewStatusComboWin.GetChildren().OfType<WinComboBox>().First(); WinWindow ComboBoxWindow = new WinWindow(); ComboBoxWindow.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); ComboBoxWindow.SearchProperties[WinWindow.PropertyNames.Name] = "ComboBox"; ComboBoxWindow.SearchProperties.Add(new PropertyExpression(WinWindow.PropertyNames.ClassName, "WindowsForms10.Window", PropertyExpressionOperator.Contains)); ComboBoxWindow.WindowTitles.Add("ComboBox"); WinWindow UIListWin = new WinWindow(ComboBoxWindow); UIListWin.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); UIListWin.SearchProperties[WinWindow.PropertyNames.ControlName] = "list"; UIListWin.WindowTitles.Add("ComboBox"); if (NewStatusComboBox.SelectedItem != CBValue) { while (NewStatusComboBox.SelectedItem != CBValue) { Mouse.Click(NewStatusComboBox); Trace.WriteLine("Clicked MOP combobox"); //NewStatusComboBox.Expanded = true; //Trace.WriteLine("Expanded MOP combobox"); System.Threading.Thread.Sleep(5000); WinList List = new WinList(UIListWin); List.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); List.WindowTitles.Add("ComboBox"); WinListItem Item = new WinListItem(UIListWin); Item.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); Item.SearchProperties.Add(WinListItem.PropertyNames.Name, CBValue); if (UIListWin.Exists && Item.Exists) { // List.SelectedItemsAsString = CBValue; Mouse.Hover(Item); Trace.WriteLine("Mouse Hover on item " + Item); //System.Threading.Thread.Sleep(3000); Mouse.DoubleClick(Item); Trace.WriteLine("Double Click " + Item); } } } Assert.IsTrue(NewStatusComboBox.SelectedItem == CBValue, "Combox value : " + NewStatusComboBox.SelectedItem.ToString() + " Does NOT EQUAL " + CBValue + " the correct item was not set"); break; } case "WellType": { WinWindow NewStatusComboWin = new WinWindow(MOPAddWellStatWin); NewStatusComboWin.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); NewStatusComboWin.SearchProperties.Add(WinWindow.PropertyNames.ControlName, "combo"); //NewStatusComboWin.SearchProperties.Add(WinWindow.PropertyNames.Instance, "2"); // NewStatusComboWin.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well"); WinComboBox NewStatusComboBox = NewStatusComboWin.GetChildren().OfType<WinComboBox>().First(); WinWindow ComboBoxWindow = new WinWindow(); ComboBoxWindow.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); ComboBoxWindow.SearchProperties[WinWindow.PropertyNames.Name] = "ComboBox"; ComboBoxWindow.SearchProperties.Add(new PropertyExpression(WinWindow.PropertyNames.ClassName, "WindowsForms10.Window", PropertyExpressionOperator.Contains)); ComboBoxWindow.WindowTitles.Add("ComboBox"); WinWindow UIListWin = new WinWindow(ComboBoxWindow); UIListWin.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); UIListWin.SearchProperties[WinWindow.PropertyNames.ControlName] = "list"; UIListWin.WindowTitles.Add("ComboBox"); if (NewStatusComboBox.SelectedItem != CBValue) { while (NewStatusComboBox.SelectedItem != CBValue) { Mouse.Click(NewStatusComboBox); Trace.WriteLine("Clicked WellType combobox"); //NewStatusComboBox.Expanded = true; //Trace.WriteLine("Expanded WellType combobox"); System.Threading.Thread.Sleep(5000); WinList List = new WinList(UIListWin); List.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); List.WindowTitles.Add("ComboBox"); WinListItem Item = new WinListItem(UIListWin); Item.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); Item.SearchProperties.Add(WinListItem.PropertyNames.Name, CBValue); if (UIListWin.Exists && Item.Exists) { // List.SelectedItemsAsString = CBValue; Mouse.Hover(Item); Trace.WriteLine("Mouse Hover on item " + Item); //System.Threading.Thread.Sleep(3000); Mouse.DoubleClick(Item); Trace.WriteLine("Mouse DoubleClick on item " + Item); } } } Assert.IsTrue(NewStatusComboBox.SelectedItem == CBValue, "Combox value : " + NewStatusComboBox.SelectedItem.ToString() + " Does NOT EQUAL " + CBValue + " the correct item was not set"); break; } case "StatusComment": { WinClient CommentClient = new WinClient(MOPAddWellStatWin); CommentClient.SearchProperties[WinControl.PropertyNames.ClassName] = "Internet Explorer_Server"; CommentClient.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well"); Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument EventDocument = new Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument(CommentClient); EventDocument.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.Id] = null; EventDocument.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.RedirectingPage] = "False"; EventDocument.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.FrameDocument] = "False"; EventDocument.FilterProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.Title] = "Adding Well Status Event to Selected Well"; EventDocument.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well"); HtmlTextArea CommentTB = new HtmlTextArea(EventDocument); CommentTB.SearchProperties[HtmlEdit.PropertyNames.Id] = "5"; CommentTB.SearchProperties[HtmlEdit.PropertyNames.Name] = null; CommentTB.SearchProperties[HtmlEdit.PropertyNames.LabeledBy] = null; CommentTB.FilterProperties[HtmlEdit.PropertyNames.Title] = null; CommentTB.FilterProperties[HtmlEdit.PropertyNames.Class] = "csTextArea"; CommentTB.FilterProperties[HtmlEdit.PropertyNames.ControlDefinition] = "tabIndex=0 id=5 title=\"\" class=csTextAre"; CommentTB.FilterProperties[HtmlEdit.PropertyNames.TagInstance] = "1"; CommentTB.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well"); Mouse.Click(CommentTB); Trace.WriteLine("Mouse Clicked inside comment textbox"); Keyboard.SendKeys(CommentTB, "A", ModifierKeys.Control); Trace.WriteLine("Control + A sent to textbox"); Keyboard.SendKeys(CBValue); Trace.WriteLine("Textbox comment set to " + CBValue); break; } case "OKGreenCheck": { WinClient CommentClient = new WinClient(MOPAddWellStatWin); CommentClient.SearchProperties[WinControl.PropertyNames.ClassName] = "Internet Explorer_Server"; CommentClient.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well"); Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument EventDocument = new Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument(CommentClient); EventDocument.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.Id] = null; EventDocument.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.RedirectingPage] = "False"; EventDocument.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.FrameDocument] = "False"; EventDocument.FilterProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.Title] = "Adding Well Status Event to Selected Well"; EventDocument.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well"); HtmlButton OkGreenCheck = new HtmlButton(EventDocument); OkGreenCheck.SearchProperties[HtmlButton.PropertyNames.Id] = "savebtn"; OkGreenCheck.SearchProperties[HtmlButton.PropertyNames.Name] = null; OkGreenCheck.SearchProperties[HtmlButton.PropertyNames.DisplayText] = null; OkGreenCheck.SearchProperties[HtmlButton.PropertyNames.Type] = "button"; OkGreenCheck.FilterProperties[HtmlButton.PropertyNames.Title] = "Add Well Status Comment"; OkGreenCheck.FilterProperties[HtmlButton.PropertyNames.Class] = null; OkGreenCheck.FilterProperties[HtmlButton.PropertyNames.ControlDefinition] = "onclick=addwlstatevnt() id=savebtn title"; OkGreenCheck.FilterProperties[HtmlButton.PropertyNames.TagInstance] = "1"; OkGreenCheck.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well"); Mouse.Click(OkGreenCheck); Trace.WriteLine("Clicked Green OK Check"); WinButton WarningOKButton = new WinButton(); WarningOKButton.SearchProperties[WinButton.PropertyNames.Name] = "OK"; WarningOKButton.WindowTitles.Add("VBScript: Warning"); WinButton ChangedOKButton = new WinButton(); ChangedOKButton.SearchProperties[WinButton.PropertyNames.Name] = "OK"; ChangedOKButton.WindowTitles.Add("VBScript: Message"); Rectangle WarningOKButtonRect = WarningOKButton.BoundingRectangle; int WarningOKButtonRectx = (WarningOKButtonRect.X + (WarningOKButtonRect.Width / 2)); int WarningOKButtonRecty = (WarningOKButtonRect.Y + (WarningOKButtonRect.Height / 2)); Mouse.Click(new Point(WarningOKButtonRectx, WarningOKButtonRecty)); Trace.WriteLine("Clicked OK on warning OK button"); if (WellName.Contains("GVFD")) { System.Threading.Thread.Sleep(20000); // ESP to Beam takes an extraordinary amount of time to change the MOP } Rectangle ChangedOKButtonRect = ChangedOKButton.BoundingRectangle; int ChangedOKButtonRectx = (ChangedOKButtonRect.X + (ChangedOKButtonRect.Width / 2)); int ChangedOKButtonRecty = (ChangedOKButtonRect.Y + (ChangedOKButtonRect.Height / 2)); Mouse.Click(new Point(ChangedOKButtonRectx, ChangedOKButtonRecty)); Trace.WriteLine("Clicked OK on MOPChanged OK button"); //Mouse.Click(WarningOKButton); break; } case "RedXButton": { WinClient CommentClient = new WinClient(MOPAddWellStatWin); CommentClient.SearchProperties[WinControl.PropertyNames.ClassName] = "Internet Explorer_Server"; CommentClient.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well"); Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument EventDocument = new Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument(CommentClient); EventDocument.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.Id] = null; EventDocument.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.RedirectingPage] = "False"; EventDocument.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.FrameDocument] = "False"; EventDocument.FilterProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.Title] = "Adding Well Status Event to Selected Well"; EventDocument.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well"); HtmlButton RedXButton = new HtmlButton(EventDocument); RedXButton.SearchProperties[HtmlButton.PropertyNames.Id] = "first"; RedXButton.SearchProperties[HtmlButton.PropertyNames.Name] = null; RedXButton.SearchProperties[HtmlButton.PropertyNames.DisplayText] = null; RedXButton.SearchProperties[HtmlButton.PropertyNames.Type] = "button"; RedXButton.FilterProperties[HtmlButton.PropertyNames.Title] = "Cancel Add"; RedXButton.FilterProperties[HtmlButton.PropertyNames.Class] = null; RedXButton.FilterProperties[HtmlButton.PropertyNames.ControlDefinition] = "onclick=canceladd() id=first title=\"Canc"; RedXButton.FilterProperties[HtmlButton.PropertyNames.TagInstance] = "2"; RedXButton.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well"); Mouse.Click(RedXButton); Trace.WriteLine("Clicked Red X Check button"); break; } } #endregion }
public WinList GetWellList() { WinWindow SearchWellWin = new WinWindow(); SearchWellWin.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); SearchWellWin.SearchProperties.Add(WinWindow.PropertyNames.ClassName, "#32770"); SearchWellWin.SearchProperties.Add(WinWindow.PropertyNames.Name, "Search Well"); WinWindow SearchWellWinEdit = new WinWindow(SearchWellWin); SearchWellWinEdit.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); SearchWellWinEdit.SearchProperties.Add(WinWindow.PropertyNames.ControlId, "1008"); WinList WellList = new WinList(SearchWellWinEdit); WellList.WindowTitles.Add("Search Well"); return WellList; }
public static string GetSelectedValue(WinList control) { return control.SelectedItemsAsString; }