Handling objects
Posted: Sun Oct 31, 2010 3:17 pm
Hi
I have a workflow, where we expect that as per the input given there might be a error message displayed or the workflow might just go on.
Say, if there is a image open functionality which takes image string as input. If the image is valid, then it shall be opened and some operations are performed. But if it is a invalid image, there would be a error dialog displayed.
In my case, I had used RxPath in the code. It works fine if the object is found, but throws an error if not found, which is known. But I would like to know if we can handle this dynamically and no error is thrown.
Here is the code snippet:
This throws a error if a valid image is passed, since the formError is not found. Can anyone please suggest what can be done here?
Thanks
Kris
I have a workflow, where we expect that as per the input given there might be a error message displayed or the workflow might just go on.
Say, if there is a image open functionality which takes image string as input. If the image is valid, then it shall be opened and some operations are performed. But if it is a invalid image, there would be a error dialog displayed.
In my case, I had used RxPath in the code. It works fine if the object is found, but throws an error if not found, which is known. But I would like to know if we can handle this dynamically and no error is thrown.
Here is the code snippet:
Code: Select all
try{
Ranorex Form formError = "/form[@title='Error'];
if (formError.Visible)
<click on ok>
<return>
else
<open image>
<do some operations on image>
<return>
}
catch(Exception e)
{
report.error(e.ToString());
}
Thanks
Kris