Unable to extract the values from Table of an desktop applic
Posted: Mon Aug 17, 2015 12:26 pm
we are trying to automate the desktop application using ranorex trial version and we are unable to extract the cell value from a table. we tried the following code to extract it. Note: Its a desktop application. not a web application.
We tried the following methods of code to extract the values from the table.
Method 1:
Table objTable=repo.ColumbusApplication.Table;
for(int i=0;i<objTable.Rows.Count;i++)
{
Report.Info("Cells Count" + objTable.Rows.Cells.Count);
for(int j=0;j<objTable.Rows.Cells.Count;j++)
{
Report.Info("Text Value" + objTable.Rows.Element.GetAttributeValue("AccessibleName"));
IList<Cell> cells = objTable.Rows.FindChildren<Cell>();
Report.Info("Cells Children count" + cells[0].Children.Count.ToString());
Report.Info("Element GetAtt text" + cells[0].Element.GetAttributeValueText("Text"));
Report.Info("child element get Att text" + cells[0].Children[0].Element.GetAttributeValueText("Text"));
Report.Info("child element get Att Accessiblename" + cells[0].Children[0].Element.GetAttributeValueText("AccessibleName"));
}
}
Method 2:
Table sheet1 = repo.ColumbusApplication.Table;
Report.Info("Count of Rows in a Table: " + sheet1.Rows.Count);
//Report.Info("Count of Columns in a Table: " + sheet1.Columns.Count);
IList<Row> iList = sheet1.Rows;
Report.Info("Row count " + iList.Count);
IList<Cell> cellList = iList[1].Cells;
Report.Info("Cell Count" + cellList.Count);
Report.Info("Text of third Cell: "+ cellList[2].Text);
We tried the following methods of code to extract the values from the table.
Method 1:
Table objTable=repo.ColumbusApplication.Table;
for(int i=0;i<objTable.Rows.Count;i++)
{
Report.Info("Cells Count" + objTable.Rows.Cells.Count);
for(int j=0;j<objTable.Rows.Cells.Count;j++)
{
Report.Info("Text Value" + objTable.Rows.Element.GetAttributeValue("AccessibleName"));
IList<Cell> cells = objTable.Rows.FindChildren<Cell>();
Report.Info("Cells Children count" + cells[0].Children.Count.ToString());
Report.Info("Element GetAtt text" + cells[0].Element.GetAttributeValueText("Text"));
Report.Info("child element get Att text" + cells[0].Children[0].Element.GetAttributeValueText("Text"));
Report.Info("child element get Att Accessiblename" + cells[0].Children[0].Element.GetAttributeValueText("AccessibleName"));
}
}
Method 2:
Table sheet1 = repo.ColumbusApplication.Table;
Report.Info("Count of Rows in a Table: " + sheet1.Rows.Count);
//Report.Info("Count of Columns in a Table: " + sheet1.Columns.Count);
IList<Row> iList = sheet1.Rows;
Report.Info("Row count " + iList.Count);
IList<Cell> cellList = iList[1].Cells;
Report.Info("Cell Count" + cellList.Count);
Report.Info("Text of third Cell: "+ cellList[2].Text);