Page 1 of 1

Unable to extract the values from Table of an desktop applic

Posted: Mon Aug 17, 2015 12:26 pm
by kathirMCA
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);

Re: Unable to extract the values from Table of an desktop applic

Posted: Tue Aug 18, 2015 7:47 am
by CookieMonster
Hi Kathir,

Could you please provide a bit more information if possible. What kind of desktop application you are trying to automate. Java. .Net with third party components, if yes, is it DevExpress or Component one or something else. Also the operating system would be useful and may also a Spy Snapshot of your Table?

And how is the report looking if you let run the script you have attached?

Cheers
Dan

Re: Unable to extract the values from Table of an desktop applic

Posted: Tue Aug 18, 2015 8:12 am
by odklizec
Hi,

The most important (missing) piece of info is Ranorex Snapshot of the table in question. Please attach one to your post or send it, along with your question, to [email protected].

You also forgot to mention your Ranorex version and if you are able to extract the table cell values with Ranorex Spy?

Without snapshot, we can provide you only with some general hints. There is also plenty of posts regarding "tables" and obtaining values from them at this forum. Anyway, attached Ranorex Snapshot is a certain way how to get more precise help.