Image File and Suite Information
The functions in this section return various properties associated with image files and Eggplant Functional suites.
ImageInfo
Function
Behavior: Returns an image property list for a single image, or a list of image property lists for multiple image references. Depending on the data that is available, the list can contain the following properties:
- CaptureDate: The date of the image capture, including time, in the format (yyyy-mm-dd hh:mm:ss +0000); the final four digits represent the GMT offset.
- CaptureHost: The name of the SUT on which the image was captured.
- CaptureLocation: Coordinates that indicate the position of the top-left corner of the image when it was captured in the Viewer window.
- CaptureScreenSize: The dimensions of the SUT screen on which the image was captured, given in pixels as (
width
,height
). - Description: The image description in the Suite Editor Info panel.
- HotSpot: The coordinates of the image's hot spot, given as (x, y).
- ImageLocation: The on-screen coordinates of the hot spot of the image. See the ImageLocation() function.
- ImageName: The name of the image file.
- ImagePath: The full pathname of the image file.
- ImageRectangle: The rectangle coordinates of the image found using the ImageRectangle() function.
- ImageSize: The image’s size in pixels, given as (
width
,height
). - ImageTolerance: The tolerance setting used when capturing the image on the SUT.
- Pulsing: Whether the image was captured with the pulsing setting (true/false).
- Scale: The scale used to capture the image.
- SearchType: The Search Type selected when saving the image.
Parameters: One or more Image References. Returns: An image property list, or list of image property lists. For example:
((CaptureDate:"2016-10-19 15:20:52 -0600", CaptureHost:"Windows", CaptureLocation:(527,707), CaptureScreenSize:(1024,768), Description:"", HotSpot:(11,19), ImageLocation:"", ImageName:"Value", ImagePath:"C:/Users/Carrie/Documents/Demo.suite/Images/ValueField.png", ImageRectangle:"", ImageSize:(23,39), Pulsing:"False", Scale:"1", SearchType:"Tolerant"))
Example:
put ImageInfo("BrowserIcon") into ListVariable //Stores the return of the imageInfo function in a variable.
Example:
put the number of items of imageInfo("CheckBox") into NumberinReturn //Stores the number of items in the return of ImageInfo.
if NumberinReturn is greater than 1 then log "There are" && NumberinReturn && "images in the collection." //Checks whether the number of items in the return is greater than 1, which means the image is actually an image collection.
Example:
copy file imageInfo("CompanyLogo")'s imagePath to folder "C:\Users\Carrie\Desktop\ResultsFolder" //Copies an image from inside the current suite to a new location on the eggPlant machine.
Example:
put the suiteinfo's imagesfolder into myimagefolder //Stores the path to the image folder in the current suite.
put the files of myimagefolder as a list into myimages //Stores the names of all files in the image folder (including imageinfo files) as a list.
repeat with each item of myimages by reference //Iterates on the list by reference instead of in memory.
if it contains "imageinfo" then delete it //Deletes the file name from the list if it's an imageinfo file.
end repeat
repeat with each item of myimages //Iterates on the remaining list of file names after the imageinfo file names have been removed.
put imageinfo(it)'s CaptureDate into mycapturedate //Stores the CaptureDate property value in a variable.
If mycapturedate is not empty and mycapturedate is earlier than 1 year ago then //Determines whether the CaptureDate occurred more than a year ago from today.
do merge of <<Logwarning "Image [[it]] was captured over a year ago.">>//Uses the merge function to construct a string and log a message.
end if
end repeat