Hiya
Quick question about Form.Find method
If I have for example:
myForm.Find("descendants::form[@title='HelloWorld']")
and nothing is found, does the method return an empty list or does it return Nothing ?
Form.Find method return value
Re: Form.Find method return value
You can catch the RanorexException and then have your method return anything you want...
Code: Select all
catch (RanorexException ex)
{
Report.Debug("Unable to find window: " + WindowName);
return null;
}
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...
Re: Form.Find method return value
Hiya
According to the API guide there is no exception from Adapter.Find
But there is a difference between List.Count=0 and Nothing
According to the API guide there is no exception from Adapter.Find
But there is a difference between List.Count=0 and Nothing
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Form.Find method return value
Hello Atom,
if you try to find just one element (FindSingle, FindChild, FindDescendant) and no element found, the 'ElementNotFoundException' will be called.
But if you try to find more elements (Find, FindChildren, FindDescendants) and no elements found you will be have an empty list (yourlist.Count=0) but no exception.
Regards,
Mhosen
Ranorex Support Team
if you try to find just one element (FindSingle, FindChild, FindDescendant) and no element found, the 'ElementNotFoundException' will be called.
But if you try to find more elements (Find, FindChildren, FindDescendants) and no elements found you will be have an empty list (yourlist.Count=0) but no exception.
Regards,
Mhosen
Ranorex Support Team