Do u have any Commands to capture the image which will disappear within fraction of seconds once the image has been clicked.
I Couldn’t capture the disappearing Image and by the time my scripts are getting failed.
I used the commands like:
If image Found(“Image2”)then
LogError"Image2 Not Found"
Repeat Until imageFound(“image2”)
Click (imageName:“Image1”, SearchRectangle: (0,0,733,469))
LogError"Image2 Not Found"
For Eggplant to see an image that is only displayed briefly on the screen is a challenge, and may not be possible to do reliably (every time) if the image only appears for a small fraction of a second. To do this, you’ll need to temporarily reduce or eliminate some of Eggplant’s built-in delays. You may also need to set the SearchRectangle to a small area of the screen, so that Eggplant doesn’t waste time searching all of the screen. I see that you’ve set a SearchRectangle when clicking Image1 in your second code example, but this should be done for Image2 if it is the image that only appears briefly.
Something like this might do what you need:
put the imageSearchDelay into ISD -- remember this
set the imageSearchDelay to 0.01
put the remoteWorkInterval into RWI -- remember this
set the remoteWorkInterval to 0.01
If imageFound(5, (imageName:"Image2", SearchRectangle: tempSearchRect)) then
Log "Image2 Found"
LogError "Image2 Not Found"
set the remoteWorkInterval to RWI -- restore this
set the imageSearchDelay to ISD -- restore this
Note that it’s important to restore the timing delays to their normal values after this search so as not to impact the functioning of the rest of your script.
The ImageFound() function in the example above will search the screen for 5 seconds waiting for Image2 to appear before it will fail (and return false). The tempSearchRect should be set to a relatively small rectangle to focus the search on the area where Image2 will appear.
Good luck, and let us know how this works for you!
when tried the said command i am getting the below mentioned errror "SRUN_BadValue;Bad Value for . Looking for a rectangel, got ‘tempsearchrect’.
We are unable to get this output when executing the script “The ImageFound() function in the example above will search the screen for 5 seconds waiting for Image2 to appear before it will fail”
Looking forward to the solution.
The variable tempSearchRect in the script that I posted was just a placeholder. To make the script complete, you’ll need to set it to a meaningful rectangle. You can either replace tempSearchRect with a hardcoded rectangle (if you know the screen coordinates where Image2 will appear) such as (200,150,400,250), or you can dynamically locate two opposite corners of the rectangle. For instance, you could add something like this at the beginning of the previous example code:
put imageLocation("topLeftCornerOfSearchArea") into topLeft
put topLeft + (200,100) into bottomRight
put (topLeft, bottomRight) into tempSearchRect
This example uses an image search to locate the top left corner of the search area, then creates a tempSearchRect that is 200 pixels wide and 100 pixels tall to the right and down from that point.
You’ll need to adapt this example code for your specific situation of course. It was only intended as a starting point for your use, not as a complete and final solution.