Page 1 of 1

trying to validate information on top panel

Posted: Tue Feb 26, 2013 5:49 pm
by EricTcg
The program that i am working with has multiple panels stacked on top of each other that are all populated at the same time. I am trying to run this code to see if certain things exist on the panel.

Code: Select all

			if(repo.BeaconClient.PotentialEquivalentsInStock.OriginalDrugDescriptionInfo.Exists())
			{
				EquivTest.Start();
				Pick.Start();
			}
			else if(repo.BeaconClient.PnlMain.RxRX15046522BBrandLEVOTHYROXINESOInfo.Exists())
			{
				
				Pick.Start();
			}
			
Since the Panels are populated before i get to this part of the code it is will never make it to the else if part of the code. So is there a way that i can find the top panel so that i can get to the second part of the code?

Re: trying to validate information on top panel

Posted: Wed Feb 27, 2013 5:31 pm
by Support Team
Hello,

You can use the Validate class.
Please read the following section in our user guide to get more information how to use this class: http://www.ranorex.com/support/user-gui ... html#c3203

Regards,
Bernhard

Re: trying to validate information on top panel

Posted: Wed Feb 27, 2013 9:07 pm
by EricTcg
I have followed what you guys have given me and i did some searching. I am having one problem when i do the validation when it search's for what is not there it fails the whole test and i would like it to continue. the code below is what i have, Am i doing something wrong?

Code: Select all

Validate.Exists(repo.BeaconClient.PnlMain.PotentialEquivalentsInStock,"Check Object '{0}'" , false)

Re: trying to validate information on top panel

Posted: Thu Feb 28, 2013 5:44 pm
by Support Team
Hello,

Plese try something like this. I used the repository item from the "Windows Start" button for this example.
if(Validate.NotExists(repo.Start.StartInfo,"Check Object '{0}'" , new Validate.Options(false, ReportLevel.Warn)))
{
     Report.Info("Do something");
}
     else
{
     Report.Info("Do something else");
}
I hope this will help you.

Regards,
Bernhard

Re: trying to validate information on top panel

Posted: Thu Feb 28, 2013 6:25 pm
by EricTcg
Thank you. This worked for me.

Re: trying to validate information on top panel

Posted: Thu Feb 28, 2013 10:21 pm
by omayer
Hi Bernhard,
How would i do with this same code using xpath instead of repo .
Thank you

Re: trying to validate information on top panel

Posted: Thu Feb 28, 2013 10:59 pm
by Ciege
omayer wrote:Hi Bernhard,
How would i do with this same code using xpath instead of repo .
Thank you
Look at the online API for the Validate Class.
Your answer is there...