getting all the tag elements of same kind

Class library usage, coding and language questions.
edxxgardo
Posts: 13
Joined: Wed Mar 10, 2010 1:22 pm

getting all the tag elements of same kind

Post by edxxgardo » Wed Mar 31, 2010 12:32 pm

Hello,

Is there any way of getting (via C# and Ranorex API) all of the tag elements from a web page under test? For example, I want to get all the <input> or <select> tags in a list-like format.
Thanks in advance,

Dario

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

Re: getting all the tag elements of same kind

Post by Support Team » Wed Mar 31, 2010 1:34 pm

Hi Dario,

With the Ranorex Method Find you will get back a IList of all <tags> if you are using the correct RxPath.
e.g.
//Difference between to listDiv only the /body//div and body/div
//You get all "Children Children" div tags from the body down
IList<DivTag> listDiv = Host.Local.Find<DivTag>("/dom[@caption~'YourHomepage']/body//div");
//You get all "Children" div from the body
IList<DivTag> listDiv = Host.Local.Find<DivTag>("/dom[@caption~'YourHomepage']/body/div");
Regards,
Peter
Ranorex Support Team
.
Image