Validation Question

Ranorex Spy, Recorder, and Studio.
ohm
Posts: 27
Joined: Thu Dec 03, 2009 7:27 pm

Validation Question

Post by ohm » Fri Dec 11, 2009 10:25 pm

Hi,

I am trying to validate if an object exits by using the following code:
Validate.Exists(repo.WebInternetExplorer.YesResultImageInfo);

In my situation the functionality might return a YesResultImage or a NoResultImage. Not anything else. How can I make Ranorex look for any of these two images. Yes/No anyone should pass the test.

Please help.
Thanks.

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

Re: Validation Question

Post by Support Team » Mon Dec 14, 2009 8:57 pm

You can, for example, use the RepoItemInfo.Exists method and check if any of the two elements exist, then pass the outcome to the Validate.IsTrue method:
Validate.IsTrue(repo.WebInternetExplorer.YesResultImageInfo.Exists() ||
    repo.WebInternetExplorer.NoResultImageInfo.Exists(),
    "None of the two elements where found.");
Regards,
Alex
Ranorex Support Team
.
Image

ohm
Posts: 27
Joined: Thu Dec 03, 2009 7:27 pm

Re: Validation Question

Post by ohm » Tue Dec 15, 2009 5:29 pm

Works!!
Great.
Really appreciate your help :)