I’ve few scripts. Each of these scripts have commands like WaitFor, AnyImageFound etc, whereby these commands have a max timing value tied to them. For example,
WaitFor 8.0, Image1 -- try to look for Image1 within 8s if AnyImageFound (5.0, Image2) then...end if -- try to look for Image2 within 5s
I’m thinking of a way to control the maximum image searching time globally. Meaning, I am hoping to have a way to edit max time specified in commands like WaitFor, ImageFound etc, without the need to hand-edit every occurence of this value.
I can think of a way to do this, which is to write the scripts like this:
WaitFor MaxTime, Image1 if AnyImageFound (MaxTime, Image2) then...end if
And, I will have another master script to control the value of MaxTime. This master script will first set MaxTime, then call the rest of the sub-scripts. This will ensure that the same MaxTime value can be propagated to all the occurences of MaxTime, used in WaitFor and ImageFound commands.
-- In master script, set MaxTime = "8.0" -- Run sub-scripts here
I know this approach will be working fine. I just need to replace the timing value in WaitFor and ImageFound in all of my scripts…I am just thinking whether there is a way to reset this max image search time in Eggplant?
I understand that there is an Eggplant option: ImageSearchTime that we can set to control the least amount of time Eggplant spends seasching for an image. I’d like to know how is this ImageSearchTime affects the max time value set in WaitFor command. Consider example below:
put getOption (ImageSearchTime) into IST set the ImageSearchTime to 10.0 WaitFor 8.0, Image1 setOption ImageSearchTime, IST
In the above example, I scripted the WaitFor command to spend at most 8.0s to look for Image1. But, at the same time, the global property ImageSearchTime is set to 10. How is the WaitFor command going to behave? Should WaitFor at least spends 10s to search for Image1? Or, WaitFor will return an error status if it failed to find Image1 within 8.0s?
I’m wondering whether this ImageSearchTime is used to specifically cater for commands without timing value attached to them. For example, Click, DoubleClick etc.
Please advice on the best approach to modify the maximum image search time globally, with the minimum changes to existing test scripts. Thanks.