Basic SenseTalk Scripting
SenseTalk is the English-like scripting language that is used to develop Eggplant Functional (EPF) scripts. This page discusses the most common SenseTalk functionality used by Eggplant Functional for testing purposes. Further learning resources are provided below. For an introductory description of the SenseTalk language and the philosophy behind it, see About SenseTalk.
You might notice that the SenseTalk language is displayed using colors, with individual elements shown in different colors. This is to aid in writing the scripts. Lines of code written in correct syntax are colored, while invalid syntax is not colorized. Colors can be modified in the Eggplant Functional Script Preferences.
Command and Function Basics
Commands and functions are used similarly, but there are some significant differences:
- Functions always have return values; commands
mighthave return values. - Functions are typically used as parameters to commands.
- Commands must be written alone, not as part of a statement; functions must be part of a statement.
Syntax Guidelines
-
Separate command and function parameters with commas:
Example:
Click "SomeImage", "SomeOtherImage" -
Enclose function parameters in parentheses:
Example:
ImageLocation("ThisImage", "ThatImage")
Data Types Used in Eggplant Functional Commands and Functions
Commands and functions in Eggplant Functionaluse a variety of data types: numbers, coordinates, strings, and property lists.
Numbers
Single numbers passed as parameters are not enclosed in quotation marks or parentheses.
Example:
ScrollWheelUp 10
Time
Time parameters are measured in seconds, unless you indicate otherwise. SenseTalk understands the terms weeks, days, hours, minutes, seconds, and milliseconds.
Examples:
Wait 75
Wait 1 minute 15 seconds
Coordinates
When numbers are given as coordinates, they are enclosed in parentheses.
Example:
Click (40,65)
Adjusted Coordinates
Eggplant Functional also allows vector arithmetic to generate a location relative to a known position.
Examples:
Click ((30,35) + (100,5))
Click (ImageLocation("SomeButton")+ (100,5))
Strings
Strings, such as file names and text literals, are enclosed in quotation marks.
Examples:
Click "CancelButton"
TypeText "Here is some text."
Note: Double angle-brackets << >> can enclose text that contains quotation marks and large blocks of text with return characters.