Unable to add the image. Cannot save an empty image
I've been using this code below to compare regions before and after an action:
Regions.AddPicture(Sys.Desktop.ActiveWindow(), "preCommand")
#Does some stuff
postCommand = Sys.Desktop.ActiveWindow()
if (not Regions.Compare("preCommand", postCommand)):
#Does some stuff
It used to work fine but suddenly it's giving me an error "Unable to add the image. Cannot save an empty image."
I should mention that this is run on a loop - it stopped someway through and then trying to restart the loop won't let me run a single comparison. Any advice?
Thank you!
Are you saying that you can't run it at all now? Or can you still start the test over and it will fail after some number of loops?
If it won't run at all, I would reboot the machine this is running on and before you start TestComplete and your app under test, make sure there are as few other apps running as possible.
If it will run a little, put a break point at the top of the loop and run it in debug. Slowing it down this way may help you see what's going off.