How do you Put the image Eggplant was looking for?

Upon failure I export all kinds of stuff to a folder... one thing that might be useful would be the image Eggplant was looking for and didn't find. How do you do that?

put expectedImage into ("~/Desktop/Logs/")

??

Comments

  • EggplantMattEggplantMatt ForumAdmin admin
    Do you want to actually copy the image or just record the name of the image? (Not that I know of a way to do either, but it's good to know what problem we're trying to solve.)

    The image isn't always an image, so sometimes there will be no image and sometimes all you could really record is the definition of the image (e.g., Text:"ark of the covenant", fontface:"Arial, fontsize:12). The main reason that there's no good way to do this is that we never really anticipated the need -- we provide a really thorough log of the script actions and the outcome and that was intended to be the way you view the results.
  • SenseTalkDougSenseTalkDoug ForumAdmin admin
    Assuming that you're using a try/catch block to trap and report the error, there is quite a bit of information available to you in the exception that you catch. As Matt pointed out, what you're looking for (and not finding) isn't always an image, and there may be a variety of ways for your script to fail. But give this a try:
    try
    	click "alarm"
    catch exception
    	put exception
    end try
    
    In this example, if alarm is an image in your suite that isn't visible on the screen, it will display something like this:

    Runtime Error at line 2: Image Not Found - click Error - No Image Found On Screen: "alarm"

    In this simple case, where the click command was looking for a single image, you can easily get the image name -- just change the "put exception" command to "put exception's imageName".

    To see everything that's contained in the exception object, do this:
    put standardFormat of exception
    
    The information in the exception will be different for different types of exceptions so you may have to experiment a bit to get just what you want.
Sign In or Register to comment.