Run Options Global Properties
These global properties determine interactions with the system under test (SUT) when you run SenseTalk scripts with Eggplant Functional. The default values are appropriate for most situations. Keep in mind that the general SenseTalk global and local properties can also be useful in Eggplant Functional scripting. (For example, the colorFormat
global property.)
In addition to the run options properties described below, SenseTalk includes additional application-specific properties for Eggplant Functional that generally affect how the application environment works with SenseTalk scripts.
Note that these values can be set as part of the Eggplant Functional Run preferences by going to Eggplant > Preferences, then selecting the Run tab. Changing the value of a property within a script affects that value for that runtime, but does not change the value set in the application preferences.
For general information about using local and global properties, see Local and Global Properties in SenseTalk.
The AdaptiveImageTolerance
Values: A positive number.
Default: 30
Behavior: Adjusts the Adaptive to Image search type's sensitivity to change between the captured image and potential image match. For more on search tolerance, see Tolerance.
Setting this value to 100 or more is likely to result in false-positive matches.
Example:
set the AdaptiveImageTolerance to 45
The AutoImageUpdateDiagnostics
Value: DynamicTolerance
, AlternateTypes
, ScalingSearch
, DiscrepancySearch
, CropEdges
, OCRSearch
, PriorLocation
, OriginalLocation
Default: Uses the values as set in the Automatic Image Diagnostics section of the Diagnostics tab of Run Preferences. Note, however, that changes made in the preferences panel won't be reflected in the default value until after you restart the application.
Behavior: The AutoImageUpdateDiagnostics
determines which search diagnostics are used for image searches when you use the Auto Update option for the Image Update panel. You can use this global property to change the diagnostics within a script run for specific searches, as required.
For information about how each search diagnostic works, see Image Diagnostics Selections. For information about the Image Update panel, see The Image Update Panel.
Example:
set the AutoImageUpdateDiagnostics to (DynamicTolerance, AlternateTypes, ScalingSearch, DiscrepancySearch, CropEdges, OCRSearch, PriorLocation, OriginalLocation)
Example:
// Stores the current settings of the global property in the variable 'OrigSettings'
put the AutoImageUpdateDiagnostics into OrigSettings
// Changes the setting for the global property
set the AutoImageUpdateDiagnostics to (OriginalLocation)
// Performs a search action using the new diagnostics settings
click image:"oContacts"
// Returns the global property to its original settings from the variable
set the AutoImageUpdateDiagnostics to OrigSettings
Related:
The AutoOCRUpdateDiagnostics
The ImageUpdateDiagnostics
The OCRUpdateDiagnostics
The AutoOCRUpdateDiagnostics
Value: CaseSensitive
, IgnoreSpaces
, TextDifference
, ValidCharacters
, ValidWords
, DPI
, Language
Default: Uses the values as set in the Automatic OCR Diagnostics section of the Diagnostics tab of Run Preferences. Note, however, that changes made in the preferences panel won't be reflected in the default value until after you restart the application.
Behavior: The AutoOCRUpdateDiagnostics
determines which search diagnostics are used for OCR text searches when you use the Auto Update option for the OCR Update panel. You can use this global property to change the diagnostics within a script run for specific searches, as required.
For information about how each search diagnostic works, see OCR Diagnostics Selections. For information about the OCR Update panel, see The OCR Update Panel.
Example:
set the AutoOCRUpdateDiagnostics to (CaseSensitive, IgnoreSpaces, TextDifference, ValidCharacters, ValidWords, DPI, Language)
Example:
// Stores the current settings of the global property in the variable 'OrigSettings'
put the AutoOCRUpdateDiagnostics into OrigSettings
set the AutoOCRUpdateDiagnostics to (CaseSensitive, ValidCharacters)
click text:"Testplant"
// Returns the global property to its original settings from the variable
set the AutoOCRUpdateDiagnostics to OrigSettings
Related:
The AutoImageUpdateDiagnostics
The ImageUpdateDiagnostics
The OCRUpdateDiagnostics
The ForceScreenRefresh
Value: True or False.
Default: False.
Behavior: The ForceScreenRefresh
determines whether Eggplant Functional refreshes the Viewer window after each command.
Example:
SetOption ForceScreenRefresh, true
the ForceScreenRefresh
is rarely necessary, and dramatically slows down script execution. However, it might be helpful with a SUT that is generating a lot of screen artifacts or running software that does not display well through the VNC server.
The ImageSearchCount
Value: A positive integer.
Default: 7
Behavior: The ImageSearchCount
determines the number of times Eggplant Functional scans the Viewer window searching for an image. When performing an image search that includes a WaitFor
, Eggplant Functional automatically adjusts the ImageSearchDelay
according to the ImageSearchCount
. You can also use the ImageSearchTime
Global Property to affect the search time for a section of image or text (OCR) searches.
Setting the ImageSearchCount
to 1 causes image searches to look at only the current Viewer window, bypassing any ImageSearchDelay
, screen refreshes, and mouse repositioning. This setting is the fastest way to perform a search, but it can be prone to failure.
The WaitFor
command and WaitFor
property can be used to set the ImageSearchCount
indirectly for a single image search. The Eggplant Functional application fits as many scans as possible into the time specified by the WaitFor
, at the frequency specified by the ImageSearchDelay
.
Example:
// Sets the number of scans in the image search to 3 for any image searches that do not have an imageSearchTime override through WaitFor
SetOption ImageSearchCount, 3
Example:
// Sets the ImageSearchCount to 5, which indirectly changes the ImageSearchDelay to .36
SetOption ImageSearchCount, 5
// Scans for the image 28 times, based on the ImageSearchDelay of .36
WaitFor 10, "Dialog"
Example:
// Stores the current value for the imageSearchCount in a variable
set ISC to the imageSearchCount
// Sets the ImageSearchCount to 1
set the imagesearchcount to 1
// Scans for the image only once per execution of the imagefound() function
repeat until imagefound(image:"Footer")
// Scans for the image only once per execution of the imagefound() function
repeat until imagefound(image:"Footer")
// Provides error handling as a way to exit the repeat loop, exit the execution, fail the script, if it takes too long for the image to appear
if the repeatIndex is 10 then throw "Image not found", "Footer not found when scrolling."
SwipeUp // Swipes the screen up if the image isn't found
end repeat
// Returns the ImageSearchCount to the original value
set the imageSearchCount to ISC
Example:
// Performs scans = (120/the ImageSearchDelay + 1), rounded down to the nearest whole number
Click (ImageName:"Done_button", waitFor: 2 minutes)
Example:
// Performs scans = (10/the ImageSearchDelay + 1 scans), rounded down to the nearest whole number
WaitFor 10, "Done_Button"
A waitFor
of 0 is a special value that sets the ImageSearchCount
to 1.
Example:
// Scans for the image only once before executing the scrolling action
repeat until imagefound(image:"Footer",waitFor:0)
// Provides error handling to exit the repeat loop if the image is not found after an acceptable number of iterations
if repeatIndex() = 7 then throw "Image not found", "Image not found when scrolling."
SwipeUp
end repeat
Related:
The ImageSearchDelay
Value: Time (in seconds).
Default: 0.3
Example:
Behavior: The ImageSearchDelay
determines the wait time between searches for an image.
Example:
Set the ImageSearchDelay to .6
Example:
// Increases the frequency of the scans to ensure detection of transient elements. Eggplant Functional attempts to search the area at this frequency, but if the area is large or you are searching for an image collection, etc., it automatically adjusts the frequency to allow each scan to complete.
Set the imageSearchDelay to 0.1
// Limits the search area to a subset of the screen, making a lower imageSearchDelay possible
WaitFor 1, (imageName:"RedLight", searchRectangle:("SignalUpperLeft","SignalLowerRight"))
Related:
The ImageSearchTime
Value: Time (in seconds).
Default: 1.8
Behavior: Determines the approximate amount of time Eggplant Functional spends on an image search or text (OCR) search before reporting a failure. It is influenced by the ImageSearchCount
and the ImageSearchDelay
.
The actual search time can be longer than the time specified by the ImageSearchTime
. For example, using an ImageSearchTime
of .3 and ImageSearchDelay
of .3 is generally enough time for 2 scans to execute, the second of which begins after .3 seconds. The scan must then finish some time after the .3 second mark. In addition, when the ImageSearchTime
is set to .3 and the ImageSearchDelay
is set to .3, Eggplant Functional always attempts 2 scans, but if each scan takes longer than the ImageSearchDelay
of .3 seconds, due to factors such as large screen size or large image collections, the frequency of the scans will automatically stretch to accommodate the factors, making the overall search take longer than the ImageSearchTime
of .3 seconds.
The actual search time can also be shorter than the time specified by the ImageSearchTime
. For example, using an ImageSearchTime
of .5 and ImageSearchDelay
of .5 is only enough time to initiate a maximum of 2 scans; a third scan could occur no sooner than at .6 seconds. If the second scan takes fewer than .2 seconds to execute, then the overall search time can be less than .5 seconds.
Example:
Set the ImageSearchTime to 5
Related: