How to count DOM in the host?

Class library usage, coding and language questions.
AutomationTester
Posts: 30
Joined: Mon Jan 21, 2013 1:31 pm

How to count DOM in the host?

Post by AutomationTester » Thu Jun 27, 2013 12:56 pm

Dear Support team,

How to count the DOMs in the host? like, using foreach loop or any mechanism. I have attached a snap and a Ranorex snapshot of this problem.
Urgent help needed.

Thanks
Amiruddin aka Automationtester
imgSnap.png
imgSnap.png (175.97 KiB) Viewed 796 times
Attachments
Snapshot.rxsnp
(842.28 KiB) Downloaded 186 times

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

Re: How to count DOM in the host?

Post by Support Team » Fri Jun 28, 2013 11:06 am

Hi,

You could for instance search for all the dom objects using the following code:
IList<WebDocument> list = Host.Local.Find<WebDocument>("/dom");
Report.Info("Count: " + list.Count);
foreach(WebDocument web in list){
            Report.Info("Domain: " + web.Domain);
}
I hope this what you are searching for.

Regards,
Markus
.
Image