/// <summary> /// Performs the playback of actions in this module. /// </summary> /// <remarks>You should not call this method directly, instead pass the module /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method /// that will in turn invoke this method.</remarks> void ITestModule.Run() { Mouse.DefaultMoveTime = 0; Keyboard.DefaultKeyPressTime = 0; Delay.SpeedFactor = 0.0; // Initiate the variable var myRepository = global::AutomatedSystemTests.AutomatedSystemTestsRepository.Instance; Ranorex.Table table = myRepository.RiskeerMainWindow.ContainerMultipleViews.MessagesDataGridView.Self; if (labelFM == "GEBU") { table = myRepository.RiskeerMainWindow.ContainerMultipleViews.DocumentViewContainer.DesignWaterLevelWaveHeightCalculationsView.LeftSide.Table.Self; } else if (labelFM == "DA") { table = myRepository.RiskeerMainWindow.ContainerMultipleViews.DocumentViewContainer.HydraulicBCDunes.Table.Self; } Row row = table.Rows[Int32.Parse(rowIndex) + 1]; Cell cell = row.Cells[Int32.Parse(columnIndex)]; cell.Focus(); cell.Select(); string currentValue = cell.Element.GetAttributeValueText("AccessibleValue"); comparisonValue = comparisonValue.ToNoGroupSeparator().ToInvariantCultureDecimalSeparator(); currentValue = currentValue.ToNoGroupSeparator().ToInvariantCultureDecimalSeparator(); Validate.AreEqual(bool.Parse(isComparisonValueExpectedToBeMet), comparisonValue == currentValue); }
public static List <List <string> > GetContents(this Ranorex.Table table) { if (table.Visible) { List <List <string> > contents = new List <List <string> >(); // contents contains rows and columns int rows = table.Rows.Count; // Get total rows first rows--; for (int x = 0; x < rows; x++) { // get text from row Accessible accValue = new Accessible(table.FindSingle(string.Format("/?/?/row[@accessiblename='Row {0}']", x))); string tableValues = accValue.Value; // remove all "(null)" here // figure out how to remove space tableValues = tableValues.Replace("(null)", " "); // split line into a list and add into list of list List <string> lsRow = tableValues.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries).ToList(); // split the string into an array of rows separated by new line characters contents.Add(lsRow); } return(contents); } else { return(null); } }
/// <summary> /// Performs the playback of actions in this module. /// </summary> /// <remarks>You should not call this method directly, instead pass the module /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method /// that will in turn invoke this method.</remarks> void ITestModule.Run() { Mouse.DefaultMoveTime = 0; Keyboard.DefaultKeyPressTime = 0; Delay.SpeedFactor = 0.0; // Initiate the variable var myRepository = global::AutomatedSystemTests.AutomatedSystemTestsRepository.Instance; Ranorex.Table table = myRepository.RiskeerMainWindow.ContainerMultipleViews.DocumentViewContainer.FM_ResultView.TableFMResultView.Self; Cell cell; int columnIndexInteger = Int32.Parse(columnIndex); if (columnIndexInteger < 0) { cell = table.Rows[Int32.Parse(rowIndex) - 1].Cells.Reverse().ToList()[Math.Abs(columnIndexInteger) - 1]; } else { cell = table.Rows[Int32.Parse(rowIndex) - 1].Cells[Int32.Parse(columnIndex)]; } cell.Focus(); cell.Select(); cell.Element.SetAttributeValue("AccessibleValue", newCellValue); }
/// <summary> /// Performs the playback of actions in this module. /// </summary> /// <remarks>You should not call this method directly, instead pass the module /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method /// that will in turn invoke this method.</remarks> void ITestModule.Run() { Mouse.DefaultMoveTime = 0; Keyboard.DefaultKeyPressTime = 0; Delay.SpeedFactor = 0.0; // Initiate the variable var myRepository = global::AutomatedSystemTests.AutomatedSystemTestsRepository.Instance; Ranorex.Table table = myRepository.RiskeerMainWindow.ContainerMultipleViews.DocumentViewContainer.FM_ResultView.TableFMResultView.Self; Cell cell; int columnIndexInteger = Int32.Parse(columnIndex); if (columnIndexInteger < 0) { cell = table.Rows[Int32.Parse(rowIndex) - 1].Cells.Reverse().ToList()[Math.Abs(columnIndexInteger) - 1]; } else { cell = table.Rows[Int32.Parse(rowIndex) - 1].Cells[Int32.Parse(columnIndex)]; } cell.Focus(); cell.Select(); string currentValue = cell.Element.GetAttributeValueText("AccessibleValue").ToNoGroupSeparator().ToInvariantCultureDecimalSeparator(); Report.Info("Validating that equality " + referenceValue + "(reference value) == " + currentValue + " (current value) is " + isReferenceValueExpectedToBeMet); Validate.AreEqual(bool.Parse(isReferenceValueExpectedToBeMet), referenceValue == currentValue); }
public void CheckRepeatedItem() { // create a table Fluid from path Ranorex.Table tblFluid = "/form[@name='frmMain']/?/?/form[@name='frmFluidBalanceModule']/?/?/tabpage[@name='tsFluidInput']/?/?/table[@class='TcxGridSite']"; // get the last row of the table Ranorex.Row lastRow = tblFluid.Rows[tblFluid.Rows.Count - 1]; // get list cells of this row IList <Cell> lstCell = lastRow.Cells; // Validate Finishlevel (cell4), VolumeGiven (cell5), and TotalRunning(cell7) are null // in code thesse number should be (number -1) Report.Log(ReportLevel.Info, "Validation", "Validate Finishlevel is empty"); Validate.AreEqual(lstCell[3].GetAttributeValue <string>("Text"), (string)null); Delay.Milliseconds(0); Report.Log(ReportLevel.Info, "Validation", "Validate VolumeGiven is empty"); Validate.AreEqual(lstCell[4].GetAttributeValue <string>("Text"), (string)null); Delay.Milliseconds(0); Report.Log(ReportLevel.Info, "Validation", "Validate TotalRunningl is empty"); Validate.AreEqual(lstCell[6].GetAttributeValue <string>("Text"), (string)null); Delay.Milliseconds(0); }
public static string GetCell(this Ranorex.Table grid, string cellName, int rowNumber) { rowNumber--; Ranorex.Cell myCel = grid.FindSingle(String.Format("?/?/cell[@accessiblename='{0} Row {1}']", cellName, rowNumber.ToString())); return(myCel.Text); }
public static int ColumnCount(this Ranorex.Table table) { Accessible accValue = new Accessible(table.FindSingle("/?/?/row[@accessiblename='Row 0']")); string tableValues = accValue.Value; List <string> lsRow = tableValues.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries).ToList(); // split the string into an array of rows separated by new line characters return(lsRow.Count); }
//********************************************************************** /// <summary> /// Click to the Cell by given index in the Table. /// </summary> public static void Click_Cell(LxScriptItem item) { object objComponet = item.getComponent(); RepoItemInfo objComponetInfo = item.getComponentInfo(); Type objType = objComponet.GetType(); if (objType.Name.ToString() == "Table") { Ranorex.Table tb = (Ranorex.Table)objComponet; tb.Rows[Convert.ToInt32(item.getArgText())].Cells[Convert.ToInt32(item.getArg2Text())].Click(); } }
public static void ClickThis(this Ranorex.Table item) { try { item.Click(); Sleep(); } catch (Exception ex) { throw new Exception("Table Click Failed : " + ex.Message); } }
//********************************************************************** /// <summary> /// Input Cell by given index in the Table. /// </summary> public static void Input_Cell(LxScriptItem item) { object objComponet = item.getComponent(); RepoItemInfo objComponetInfo = item.getComponentInfo(); Type objType = objComponet.GetType(); if (objType.Name.ToString() == "Table") { Ranorex.Table tb = (Ranorex.Table)objComponet; tb.Rows[Convert.ToInt32(item.getArgText())].Cells[Convert.ToInt32(item.getArg2Text())].DoubleClick(); Keyboard.Press("{CONTROL down}{Akey}{CONTROL up}" + item.getArg3Text()); } }
public static void SelectCell(this Ranorex.Table grid, string cellName, int rowNumber, string text) { rowNumber--; Ranorex.Cell myCel = grid.FindSingle(String.Format("?/?/cell[@accessiblename='{0} Row {1}']", cellName, rowNumber.ToString())); // myCel.Click(); // myCel.ClickWithoutBoundsCheck(Location.Center); myCel.ClickWithoutBoundsCheck(Location.CenterLeft); if (text != "") { myCel.PressKeys(text); } }
public static IList <Cell> GetLastRowOfTable(string xPath) { IList <Cell> lstCell = null; // create a table from path Ranorex.Table tblFluid = xPath; if (tblFluid != null) { // get the last row of the table Ranorex.Row lastRow = tblFluid.Rows[tblFluid.Rows.Count - 1]; // get list cells of last row lstCell = lastRow.Cells; } return(lstCell); }
public void SelectFirstOutputItem() { // create a table Fluid from path Ranorex.Table tblFluid = "/form[@controlname='frmMain']/?/?/form[@name='frmFluidBalanceModule']/?/?/tabpage[@name='tsFluidOutput']/?/?/table[@class='TcxGridSite']"; // get the first row of the table if (tblFluid.Rows.Count > 0) { Ranorex.Row firstRow = tblFluid.Rows[1]; // get list cells of this row IList <Cell> lstCell = firstRow.Cells; // get time of firt Output fluid string sttrTime = lstCell[0].GetAttributeValue <string>("Text"); repo.TimeAddFluid = sttrTime; Delay.Milliseconds(0); } }
private int findElementColNameTableControl(Ranorex.Table table, int element, string ColumnName) { for (int i = 1; i <= table.Children[1].Children.Count; i++) { for (int t = 0; t <= table.Children[1].Children[i].Children.Count; t++) { if (((Ranorex.Plugin.MsaaFlavorElement)table.Children[1].Children[i].Children[t].Element.FlavorElement).Name.Replace(" row 0", "") == ColumnName) { element = t; break; } } break; } return(element); }
public static void SelectCell(this Ranorex.Table grid, string cellName, int rowNumber) { SelectCell(grid, cellName, rowNumber, ""); }
public void FlowInputRx(RepoItemInfo textInfo) { var DateEditKB = repo.FrmMain.List25ThangMươiMot1944; DateEditKB.DoubleClick(); DateEditKB.PressKeys("05092018", 200); int elementofTrangThai; var tabledsBN = repo.FrmMain.Table1; var buttonLoc = repo.FrmMain.ButtonLọc1; buttonLoc.Click(); elementofTrangThai = findElementColNameTableControl(tabledsBN, 0, "Trạng thái"); if (tabledsBN.Children[1].Children.Count != 0) { for (int i = 1; i <= tabledsBN.Children[1].Children.Count; i++) { string obj; obj = ((Ranorex.Plugin.MsaaFlavorElement)tabledsBN.Children[1].Children[i].Children[elementofTrangThai].Element.FlavorElement).Value; if (obj == "Đang khám") { tabledsBN.Children[1].Children[i].DoubleClick(); chỉĐịnhDịchVụF5 = repo.FrmNewDetail.ChỉĐịnhDịchVụF5; khamBệnhF1 = repo.FrmNewDetail.KhamBệnhF1; keĐơnF6 = repo.FrmNewDetail.KeĐơnF6; //var keĐơnF6 = repo.FrmNewDetail.KeĐơnF6; #region SaveReason if (!khamBệnhF1.Pressed) { khamBệnhF1.Click(); #region init control richEditControl1 = repo.FrmNewDetail.RichEditControl1; #endregion Mouse.Click(richEditControl1.ScreenRectangle.Location); richEditControl1.PressKeys("Reason", 0); Keyboard.EscapeSequence("Reason"); // var txtICDChinh = repo.FrmNewDetail.TextMaskBox; // txtICDChinh.PressKeys("K51",0); // Keyboard.Down(Keys.Tab); // Keyboard.Down(Keys.Tab); // var txtICDPhu = repo.FrmNewDetail.MainPanel.TextMaskBox1; // txtICDChinh.PressKeys("K52",0); //Keyboard.Down(Keys.Tab); // Keyboard.Down(Keys.Tab); } #endregion #region SaveClinical if (!chỉĐịnhDịchVụF5.Pressed) { chỉĐịnhDịchVụF5.Click(); if (!isFirstStart) { btnSaveClinic = repo.FrmNewDetail.MainPanel.ButtonLưu1.ScreenRectangle.Location; btnPrintClinic = repo.FrmNewDetail.MainPanel.InChỉĐịnh.ScreenRectangle.Location; tableChiDinh = repo.FrmNewDetail.MainPanel.Table1; } for (int elemclinic = 0; elemclinic < 3; elemclinic++) { if (!isFirstStart) { elemchidinh[elemclinic] = tableChiDinh.Children[1].Children[elemclinic].ScreenRectangle.Location; } //tableChiDinh.Children[1].Children[elemclinic].DoubleClick(); Mouse.DoubleClick(elemchidinh[elemclinic]); Report.Log(ReportLevel.Info, "Select clinic"); } Mouse.Click(btnSaveClinic); Thread.Sleep(2000); //btnSaveClinic.Click(); DialogPopup(); //Thread.Sleep(Convert.ToInt32(repo.StartFoxitPhantomPDF.SearchTimeout)); //btnPrintClinic.Click(); Mouse.Click(btnPrintClinic); if (repo.Shell1.SelfInfo.Exists(2000))//check exist { Report.Error("error when printed InPhieuChiDInh!"); Report.Screenshot(); Keyboard.Down(Keys.Enter); } //Thread.Sleep(5000); repo.StartFoxitPhantomPDF.SelfInfo.WaitForExists(5000); } #endregion #region SaveDiagnosis if (!khamBệnhF1.Pressed) { khamBệnhF1.Click(); var txtICDChinh = repo.FrmNewDetail.MainPanel.TextMaskBox1; if (((Ranorex.Plugin.WinFormsFlavorElement)txtICDChinh.Element.FlavorElement).Text.Trim() == "") { txtICDChinh.PressKeys("K51", 0); Keyboard.Down(Keys.Tab); Keyboard.Down(Keys.Tab); Report.Log(ReportLevel.Info, "Keyboard", "MainICD: " + "K51", repo.FrmNewDetail.MainPanel.TextMaskBox1Info, new RecordItemIndex(1)); } var txtICDPhu = repo.FrmNewDetail.MainPanel.TextMaskBox; if (((Ranorex.Plugin.WinFormsFlavorElement)txtICDPhu.Element.FlavorElement).Text.Trim() == "") { txtICDPhu.PressKeys("K52", 0); Keyboard.Down(Keys.Tab); Keyboard.Down(Keys.Tab); Report.Log(ReportLevel.Info, "Keyboard", "MainICD: " + "K52", repo.FrmNewDetail.MainPanel.TextMaskBoxInfo, new RecordItemIndex(1)); } } #endregion #region SaveRX if (keĐơnF6.Pressed == false) { //Keyboard.Down(Keys.F6); keĐơnF6.Click(); #region init control var txtRepeat = repo.FrmNewDetail.TableLayoutPanel1.txtRepeat; element = txtRepeat.Element; var textBoxMaskBox = repo.FrmNewDetail.TableLayoutPanel1.searchLookupProduct; var txtMorning = repo.FrmNewDetail.TableLayoutPanel1.txtMorning; var txtAfternoon = repo.FrmNewDetail.TableLayoutPanel1.txtAfternoon; var txtLunch = repo.FrmNewDetail.TableLayoutPanel1.txtLunch; var txtEvening = repo.FrmNewDetail.TableLayoutPanel1.txtEvening; var txtQty = repo.FrmNewDetail.TableLayoutPanel1.txtQty; #endregion Table = repo.FrmNewDetail.Table; for (int j = 0; j <= Data.Rows.Count - 1; j++) { var row = Data.Rows[j]; if (Table.Children[1].Children.Count == 0 && ((Ranorex.Plugin.WinFormsFlavorElement)txtRepeat.Element.FlavorElement).Text.Trim() == "") { txtRepeat.PressKeys(row.Values[1].ToString()); } else { //do nothing } textBoxMaskBox.PressKeys(row.Values[0].ToString(), 0); Report.Log(ReportLevel.Info, "Keyboard", "Product is input " + row.Values[0].ToString(), repo.FrmNewDetail.TableLayoutPanel1.searchLookupProductInfo, new RecordItemIndex(j)); Keyboard.Down(Keys.Enter); Report.Log(ReportLevel.Info, "Press enter"); //var tenSPRow0 = repo.Shell1.TenSPRow0; //tenSPRow0.Click(); txtMorning.PressKeys(row.Values[2].ToString(), 0); Report.Log(ReportLevel.Info, "Keyboard", "Morning is input " + row.Values[2].ToString(), repo.FrmNewDetail.TableLayoutPanel1.txtMorningInfo, new RecordItemIndex(j)); txtAfternoon.PressKeys(row.Values[4].ToString(), 0); Report.Log(ReportLevel.Info, "Keyboard", "Afternoon is input " + row.Values[4].ToString(), repo.FrmNewDetail.TableLayoutPanel1.txtAfternoonInfo, new RecordItemIndex(j)); txtLunch.PressKeys(row.Values[3].ToString(), 0); Report.Log(ReportLevel.Info, "Keyboard", "Lunch is input " + row.Values[3].ToString(), repo.FrmNewDetail.TableLayoutPanel1.txtLunchInfo, new RecordItemIndex(j)); txtEvening.PressKeys(row.Values[5].ToString(), 0); Report.Log(ReportLevel.Info, "Keyboard", "Evening is input " + row.Values[5].ToString(), repo.FrmNewDetail.TableLayoutPanel1.txtEveningInfo, new RecordItemIndex(j)); txtQty.PressKeys("2", 0); Report.Log(ReportLevel.Info, "Keyboard", "Quanity is input '2'.", repo.FrmNewDetail.TableLayoutPanel1.txtQtyInfo, new RecordItemIndex(j)); Mouseclick(j); } } #endregion } } } }