Page 1 of 1

Re: iterate through h2tag elements and get innertext!

Posted: Wed Feb 24, 2021 10:31 am
by manish
Hi,

Could you try using the Find to get all H2Tags from your repo element.

Something like this

Code: Select all

			var repo = BottomLineIIRepository.Instance;
			var acclist = repo.DigitalBanking.Accounts.acclist;
			Report.Log(ReportLevel.Info,"starting test");

			IList<Ranorex.H2Tag> accnamelist = repo.DigitalBanking.Accounts.acclistInfo.Find<H2Tag>("//h2tag");
			List<Ranorex.H2Tag> names = new List<H2Tag> {};
			foreach (var tagh2 in accnamelist){
				names.Add(tagh2.Element.GetAttributeValueText("innertext").ToString());
				Report.Info("account name is: "+names);
			}

This will give all the J2tags present below acclist . If you wish to find only the immediate children then use FindChildren method.

Thanks
Manish