Iterator Use

Ask general questions here.
samarthpukale
Posts: 8
Joined: Tue Feb 19, 2019 7:44 am

Iterator Use

Post by samarthpukale » Wed Mar 06, 2019 2:37 pm

Hello Team,
I want to know how to use iterator(Advance for loop) in Ranorex and print the values one by one.

Thanks,
Samarth Pukale

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

Re: Iterator Use

Post by odklizec » Wed Mar 06, 2019 3:22 pm

Hi,

Could you please describe in more details, what exactly you want to do and where you want to print the values you are looking for? Do you mean data connector (testcase/smartfolder) iteration number?
Last edited by odklizec on Wed Mar 06, 2019 8:29 pm, edited 1 time in total.
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

User avatar
Support Team
Site Admin
Site Admin
Posts: 11774
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Iterator Use

Post by Support Team » Wed Mar 06, 2019 8:26 pm

Hi samarthpukale,

Perhaps you are looking for something similar to this users forum post? Here is a slight modification to print the attribute 'Text' values of each element:

Code: Select all

List<Element> myElements = new List<Element>();
myElements.Add(repo.FormRun.ButtonOK);
myElements.Add(repo.FormRun.Cancel);
myElements.Add(repo.FormRun.ButtonBrowse);

foreach (var element in myElements)
	Report.Info(element.GetAttributeValueText("Text"));
Cheers,
Ned
.
Image