Working Evironment: win7 ,Ranorex2.02
Step:
To judge whether a form exist , we can use
Try
{
....Form action
}
Catch()
{
}
.
But seems validate.Exists also offer a way . So i use Exists like this
if (Ranorex.validate.Exists(repo.SimpleModel.Self,"xx",false)==false)
{
}
According to usage in UserGuide , set boolean to false should not provoke an exceptioin . Actually, when program run to if() , and the form does not exist ,it will throw out an exception , which state the form does not exist
How do i use validate.Exists(element,message,boolean)
See the code I pasted in this thread: http://www.ranorex.com/forum/waiting-fo ... -t775.html
It may help you out a bit on how to deal with the potential exception if a window/form does not exist.
It may help you out a bit on how to deal with the potential exception if a window/form does not exist.
Solved incompletely
I use Validate.Exists(repo.SimpleMode.self,"{0}",false) , it can pass.
But if repo.SimpleMode not exist ,before invoke Validate.Exists return, Ranorex still throw out an exception.
But if repo.SimpleMode not exist ,before invoke Validate.Exists return, Ranorex still throw out an exception.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Unfortunately, the Validate.Exists method does not really work as expected when calling it as you described:
best regards,
Christoph
Ranorex Support Team
The problem why Ranorex throws an exception is, because of the statement repo.SimpleMode.Self specified as first parameter. The Ranorex Repository tries to resolve the RanoreXPath expression behind the repository object automatically and throws an 'ElementNotFoundException' before getting a chance to do the exists validation. We'll try to offer a better solution with the future releases.Validate.Exists(repo.SimpleMode.self,"{0}",false)
best regards,
Christoph
Ranorex Support Team