Top 10 SenseTalk Commands and Functions for Eggplant Functional Scripting
Eggplant Functional provides multiple ways to create your test scripts and code snippets, including Turbo Capture sessions, Autosnippet Generation, and Assisted Scripting. Each of these methods interacts with the Viewer window to help you generate SenseTalk code in the Script Editor.
However, you still need to review and revise your code, and you’ll probably need to manually create more advanced SenseTalk scripts eventually. For those situations, here's a quick top 10 list of useful SenseTalk commands and functions, along with some tips about when and where you might want to use them.
1. The Click Command
Use the Click
command to click a location on your system under test (SUT) just as you would with the mouse button. Typically, you specify the location to click with an image reference:
Click "Launch_Chrome" // Performs a click action at the screen location that matches the image named Launch_Chrome
You can also specify the click location with text, which uses OCR to search the screen for the text provided:
Click text:"Eggplant" // Performs a click action at the screen location where OCR finds the indicated text
The Click
command is useful for interacting with the SUT in a variety of ways, such as clicking buttons, icons, links, checkboxes, and menu options. You can also use it to click in a field so that you can enter text there, or otherwise click any area of the SUT screen to set the focus of the mouse pointer.
If you are testing against mobile device SUTs, you might choose to use the Tap
command instead of Click
because a tap is a more natural way to think of the user action on those devices. However, the Click
and Tap
commands are functionally the same, and both can be used on either desktop or mobile OSs.
Related
- Mouse Events and Control: Learn about related commands such as
DoubleClick
,DoubleTap
,RightClick
, and so forth. - The Hot Spot: Learn how to move the image hot spot so that your click action takes place somewhere other than the center of the image, including outside of the image.
- Image Property List: Find out about the additional properties you can use with
Click
(and any image search) to improve your scripting.
2. The TypeText Command
The TypeText
command sends keystrokes to the SUT, so it's useful for entering all types of keyboard input. You can enter text in documents or use it to enter data in form fields, such as when you need to automate entering a username and password on a web page or application.
You can use this command to send keyboard commands that work within applications, such as Ctrl+C for copy and Ctrl+V for paste. You can also send keyboard commands that control aspects of the OS, such as Alt+tab (Windows) or Cmd+tab (Mac) to switch between applications.
To send literal text, enclose the text in quotes:
TypeText "Hello World!" // Sends the text string to the SUT