Validating data which has html tags in it

Ask general questions here.
leon
Posts: 14
Joined: Fri Jul 22, 2011 8:12 am

Validating data which has html tags in it

Post by leon » Thu Mar 01, 2012 9:03 am

Hi Support team

I would like to know how do I validate data in the body of a Dom on my application which contains text and html tags. Ranorex picks is up as 3 or 4 different levels depending on the amount of tags and each tag section is put in a separate span.

My Application data is as follows:
Drag the <functional_name> <control_type> and drop it on <dest_functional_name>.

Ranorex spies it as follows:

Dom
<> Body
- <> P [innertext = 'Drag the and drop it on .']
<> Span [innertext = '<functional_name>']
<> Span [innertext = '<control_type>']
<> Span [innertext = '<dest_functional_name>']


My data table in my Suite [which is the same as my application data so my script should pass]:
Drag the <functional_name> <control_type> and drop it on <dest_functional_name>.


I need some sort of concatination of some sorts but not sure if it is possible in Ranorex. Currently I am only using normal Ranorex mapping thus not writing any special code. Then these innertext fields I then will make a variable.

I hope there is a solution for this

Thanks

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

Re: Validating data which has html tags in it

Post by Support Team » Fri Mar 02, 2012 10:08 am

Hi,

basically you can validate the "InnerText"-attribute of the html object holding these tags:
Validate.AreEqual(<Containing Object>.GetInnerHtml(), "<the expected Inner HTML>");
whereas <Containing Object> is the repository item holding your html tags and <the expected Inner HTML> is the html code of your html tags.

Regards,
Tobias
Ranorex Team
.
Image