Hi,
Validate step gives success for the object even it there is video on screen, however code below (for getting video for success scenario) step fails when there is no video.
So how can I change this code for using not video exist ? I looked at methods but can not find useful for me.
Bitmap bmp = Imaging.CaptureImage(repo.JSLAPICallExample.BlobHttpsMulti2lbNetasComTr18581);
How to determine a video not exist for an existing object
How to determine a video not exist for an existing object
Last edited by rastek on Mon Jan 30, 2017 2:14 pm, edited 1 time in total.
Re: How to determine a video not exist for an existing object
Hi,
I'm not quite sure what exactly you want to do and without at least a Ranorex snapshot, it's very hard to suggest something reliable. But if you simply want to validate an element does not contain a video and the Imaging.CaptureImage fails if there is no video available, then I would suggest to enclose the method in Try...Catch block. This way you can suppress the exception and simply "validate" that the video is NOT available. For example, you can try something like this...
I'm not quite sure what exactly you want to do and without at least a Ranorex snapshot, it's very hard to suggest something reliable. But if you simply want to validate an element does not contain a video and the Imaging.CaptureImage fails if there is no video available, then I would suggest to enclose the method in Try...Catch block. This way you can suppress the exception and simply "validate" that the video is NOT available. For example, you can try something like this...
Code: Select all
try
{
Bitmap bmp = Imaging.CaptureImage(repo.JSLAPICallExample.BlobHttpsMulti2lbNetasComTr18581);
}
catch (RanorexException e)
{
Report.Success("Video is not available."); //process the exception here
}
Last edited by odklizec on Mon Jan 30, 2017 12:11 pm, edited 1 time in total.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: How to determine a video not exist for an existing object
Thanks odklizec, that helped!
By the way is there an option to mark a post as solved ?
By the way is there an option to mark a post as solved ?
Re: How to determine a video not exist for an existing object
I'm glad it helped
And no, I don't think there is a way to mark the forum post as "solved". But you can always edit your initial post and add "SOLVED" to the subject line 


Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: How to determine a video not exist for an existing object
And an additional question, how can I modify code so that it reports error when there is video, because "no video" case is working with your code but this time there is no error for faulty situation (in which there is video and bmp can be saved.)
Re: How to determine a video not exist for an existing object
You can use one of the following. The report.fail will only report it failed, and continue the test case, while the validate.fail will stop your test (depending on your error behavior).rastek wrote:And an additional question, how can I modify code so that it reports error when there is video, because "no video" case is working with your code but this time there is no error for faulty situation (in which there is video and bmp can be saved.)
Code: Select all
Report.Failure("Video is not available.");
Code: Select all
Validate.Fail("Video is not available.");
Re: How to determine a video not exist for an existing object
The question I was asking is that how will I modify code for both situation ? after try-catch block ?
try
{
Bitmap bmp = Imaging.CaptureImage(repo.JSLAPICallExample.BlobHttpsMulti2lbNetasComTr18581);
}
catch (RanorexException e)
{
Report.Success("Video is not available."); //process the exception here
}
Validate.Fail("Video is not available.");
try
{
Bitmap bmp = Imaging.CaptureImage(repo.JSLAPICallExample.BlobHttpsMulti2lbNetasComTr18581);
}
catch (RanorexException e)
{
Report.Success("Video is not available."); //process the exception here
}
Validate.Fail("Video is not available.");
Re: How to determine a video not exist for an existing object
I don't fully understand the question. Are you wanting to report.failure if the BMP exist, and report.success if not? If so, the following should help.rastek wrote:The question I was asking is that how will I modify code for both situation ? after try-catch block ?
Code: Select all
try
{
Bitmap bmp = Imaging.CaptureImage(repo.JSLAPICallExample.BlobHttpsMulti2lbNetasComTr18581);
Report.Failure("Video is available.");
}
catch (RanorexException e)
{
Report.Success("Video is not available."); //process the exception here
}