Default WaitFor seconds

Couple of usage Questions:

  1. Is there a way to set/change the default value to wait for an image or text without explicitly specifying the WaitFor property on each and every command like Click, ImageFound, etc.

  2. Can we specify the parameters without specifying the property name like:

Click secs_to_wait, "my text on screen", some_rect

--instead of
Click WaitFor: secs_to_wait, text: "my text on screen", SearchRectangle: some_rect

Appreciate any inputs.

Hey @scsvel,

Open the eggplant > Preferences > Run > Screen
The three options in the Search Timing influence the default behavior.
image

I hope I get the math right :wink:
It should be for images
(image Search Time + Search Delay) * Search Count = total waitfor time

For text it is not directly influenceable as the OCR engine processing time does vary according to text on screen.

Cheers,
Karsten

1 Like

Actually, the math is a bit different. :grinning:
The correct formula is:
ImageSearchTime = ImageSearchDelay * (ImageSearchCount - 1)
If you play with the numbers on that panel you’ll see that they always maintain that relationship.
The actual time that Eggplant spends searching for an element on the screen is not entirely predictable because it depends on how long it takes to search the screen once. Basically, it scans the screen for the image or text it is looking for. If it’s found, we’re done. Otherwise, if the ImageSearchDelay time hasn’t already passed, we wait that long and then the screen is refreshed (updated from the SUT). We repeat this until we have searched the screen ImageSearchCount times.
So, the total time spent on a failed search is at least the ImageSearchTime (or the WaitFor time if it is given) but usually somewhat longer.

2 Likes

Thanks. This will be helpful for me.

I understand the timing would be little extra/less based on Eggplant screen processing but setting up approx. max wait time using these is helpful for me as no need to pass everytime in each command line using WaitFor property unless I want a different waitfor value.

Exactly. ImageSearchTime (and its component parts) provide the default behavior, and the WaitFor property on a specific search will override that.