Unable to extract the values from Table of an desktop applic

Experiences, small talk, and other automation gossip.
kathirMCA
Posts: 1
Joined: Mon Aug 10, 2015 2:56 pm

Unable to extract the values from Table of an desktop applic

Post by kathirMCA » 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);

CookieMonster
Certified Professional
Certified Professional
Posts: 74
Joined: Mon Aug 14, 2006 7:17 pm
Location: CH

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

Post by CookieMonster » Tue Aug 18, 2015 7:47 am

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

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

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

Post by odklizec » Tue Aug 18, 2015 8:12 am

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.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration