Validating an image and using it in a while loop

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
manalitatke
Posts: 36
Joined: Mon Jan 16, 2017 3:24 pm

Validating an image and using it in a while loop

Post by manalitatke » Tue Nov 21, 2017 4:03 pm

Hello,
While proceeding to next step from my previous step as seen in the ranorex snapshot,

I am trying to go to the next step by selecting next step, however, if i do not introduce a delay/ waitfor attribute to validate the progress bar screenshots, it somehow skips the next button mouse click, and tries to search my next window.

While proceeding from step 1 to step 2, i want to introduce a 'waitforattribute contains image' from step 1 to step 2 by following the below method:

While ( validate.contains image for step 1 == true)
{
Waitforattribute(500 ms , image from step2)
}

Eg:

As attached in the snapshot, the window (step 1) contains a progress bar, that proceeds to completion.
I have taken ranorex screenshots of the progress bar while it just started to buffer and when it was about to complete. The next button is initially disabled and gets enabled only when the progress bar has been completely green.

I am validating all these ranorex screenshots in my step 1 validate image, and putting them in the while condition.

However, the problem is :
If i say i want to validate a screenshot image from step 1

while ((Validate.ContainsImage(progressbarInfo, GenerateScriptProgressBar_Screenshot1, GenerateScriptProgressBar_Screenshot1_Options)== true) ||
(Validate.ContainsImage(progressbarInfo, GenerateScriptProgressBar_Screenshot3, GenerateScriptProgressBar_Screenshot3_Options)=true) )
{
Wait_For_STEP2(500, step2_screenshot);

}

it gives me an error saying boolean action cannot be performed for a validate.contains image.

Can you please help as to how i can introduce a validate.Contains image in while loop for evaluating it as 'currently existing' or true action?


Thanks
Attachments
window.rxsnp
(56.64 KiB) Downloaded 15 times

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3921
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Validating an image and using it in a while loop

Post by odklizec » Wed Nov 22, 2017 8:46 am

Hi,

In my opinion, you should forget about using screenshots for progress bar validation. From the snapshot you uploaded, it appears that the progress bar provides Value attribute? Which means, you can check and validate the actual progress, using numerical value, instead or relying on screenshots.
Pavel Kudrys
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