Hi,
What is the best practice way to find out, whether the element
can be instanciated per xpath??
Should I use the Exists()-Methode?
Thanks for the tip.
Oliver
Common way to find out, whether control is existing
-
- Posts: 18
- Joined: Fri Jan 23, 2009 2:04 pm
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Well if your test requires the element to exist, it is usually best
to use:
If you are looking for a collection of elements, then use the Find() methods
which return a list of adapters or elements.
Validate.Exists(path) is used as an explicit checkpoint which throw ValidationExceptions with a custom message.
There is also an Exists() overload which switches off exceptions and returns "false" instead.
Michael
Ranorex Team
to use:
Code: Select all
try
{
... find(), automation actions, etc. ...
}
catch(ElementNotFoundException)
{
.. element was not found ...
}
which return a list of adapters or elements.
Validate.Exists(path) is used as an explicit checkpoint which throw ValidationExceptions with a custom message.
There is also an Exists() overload which switches off exceptions and returns "false" instead.
Code: Select all
if (!Exists("/my/element/path", 5000, "", false))
{
.. element was not found ...
}
Ranorex Team