public interface ScriptingContext extends Map
T-Plan Robot Enterprise, (C) 2009-2022 T-Plan Limited. All rights reserved.
Modifier and Type | Field and Description |
---|---|
static String |
COMPARETO_CLICK_X |
static String |
COMPARETO_CLICK_Y |
static String |
COMPARETO_DISPLAY_NO |
static String |
COMPARETO_PASS_RATE |
static String |
COMPARETO_RESULT |
static String |
COMPARETO_SORT_MODE |
static String |
COMPARETO_SOURCE_X |
static String |
COMPARETO_SOURCE_Y |
static String |
COMPARETO_TEMPLATE |
static String |
COMPARETO_TEMPLATE_HEIGHT |
static String |
COMPARETO_TEMPLATE_INDEX |
static String |
COMPARETO_TEMPLATE_WIDTH |
static String |
COMPARETO_TIME_IN_MS |
static String |
CONTEXT_CLI_VARIABLE_MAP
Key to a repository object - script variables passed via CLI arguments.
|
static String |
CONTEXT_CLIENT
Key to a repository object - desktop client.
|
static String |
CONTEXT_CODE_LINE_COUNTER
Key of a context object - a counter showing number of compiled/executed code lines.
|
static String |
CONTEXT_COMMENT_LIST
Key of a context object - list of collected comments (since 2.3.1).
|
static String |
CONTEXT_COMPILATION_ERRORS
Key to a repository object - list of validation errors, i.e.
|
static String |
CONTEXT_COMPILATION_FLAG
Key to a repository object - a flag showing whether this is a validation repository or an execution one.
|
static String |
CONTEXT_COMPILER_PROGRESS
Key to a repository object - compiler progress (a number between 0 and
1).
|
static String |
CONTEXT_CONNECT_THROWABLE
Key of a context object - Throwable (exception) from a failed attempt to connect to a desktop.
|
static String |
CONTEXT_CURRENT_DOCUMENT_ELEMENT
Key to a repository object - currently executed document element.
|
static String |
CONTEXT_CURRENT_DOCUMENT_ELEMENT_TEXT
Key to a repository object - currently executed document element text.
|
static String |
CONTEXT_CURRENT_SCRIPT_WRAPPER
Key to a repository object - current script wrapper.
|
static String |
CONTEXT_DEBUG_MODE_FLAG
Key to a repository object - debug flag.
|
static String |
CONTEXT_DO_NOT_DESTROY_FLAG
Key of a context object - a flag blocking destroying of the context (since 2.3).
|
static String |
CONTEXT_EVENT_SOURCE
Key to a repository object - a Component instance which should be used as
MouseEvent and KeyEvent source
|
static String |
CONTEXT_EXECUTION_DURATION
Key to a repository object - duration of script execution.
|
static String |
CONTEXT_EXECUTION_ERROR
Key of a context object populated with error text when a script execution fails
to start (for example when a Java test script fails to compile or there's no Java compiler)
|
static String |
CONTEXT_EXECUTION_LOG
Key of a context object holding the script status data.
|
static String |
CONTEXT_EXECUTION_START_DATE
Key to a repository object - execution start date and time.
|
static String |
CONTEXT_GOTO_TARGET_LABEL
Key to a repository object - labels of the GoTo command
|
static String |
CONTEXT_IMAGE_SEARCH_POINT_LIST
Key to a repository object - a List of coordinates resulted from an image search
|
static String |
CONTEXT_INTERPRET
Key of a context object - test script interpret.
|
static String |
CONTEXT_LABEL_MAP
Key to a repository object - labels of the GoTo command
|
static String |
CONTEXT_LAST_EXECUTED_DOCUMENT_ELEMENT
Key to a repository object - last executed document element.
|
static String |
CONTEXT_LAST_GENERATED_CLIENT_EVENT
Key of a context object - last script generated client event such as MouseEvent or KeyEvent (since 2.3).
|
static String |
CONTEXT_MASTER_INTERPRET
Key of a context object - last used template image meta data.
|
static String |
CONTEXT_MASTER_SCRIPT_WRAPPER
Key to a repository object - master script wrapper.
|
static String |
CONTEXT_OCR_LAST_TEXT
Key of a context object containing the last recognized text by an OCR method or similar..
|
static String |
CONTEXT_OCR_LAST_TEXT_MAP
Key of a context object - map of texts and their coordinates recognized by the last call
of an OCR method or similar.
|
static String |
CONTEXT_OCR_LAST_TEXT_RECT
Key of a context object containing rectangle of the last text recognized by an OCR method or similar..
|
static String |
CONTEXT_OUTPUT_OBJECTS
Key to a repository object - list with output objects, i.e.
|
static String |
CONTEXT_OUTPUT_PATH_ELEMENT |
static String |
CONTEXT_OWNING_SCHEDULE
Key of a context object - the schedule owning the executing script.
|
static String |
CONTEXT_PARSER
Key to a repository object - a List of coordinates resulted from an image search
|
static String |
CONTEXT_PARTIAL_EXECUTION_END_REACHED
Key of a context flag indicating that end of a selection execution has been reached.
|
static String |
CONTEXT_PAUSE_REASON
Key to a repository object - a reason (String) describing why script
execution was paused.
|
static String |
CONTEXT_PROCEDURE_ARG_MAP
Key to a repository object - map with procedure arguments.
|
static String |
CONTEXT_PROCEDURE_DECLARATION_FLAG
Key to a repository object - a flag indicating whether we are in a procedure declaration or not
|
static String |
CONTEXT_PROCEDURE_MAP
Key to a repository object - procedure table.
|
static String |
CONTEXT_PROGRAMMATIC_PAUSE_FLAG
Key to a repository object - a flag (Boolean) indicating a programmatic
pause which is not supposed to pop up the GUI on a local connection.
|
static String |
CONTEXT_PROJECT_BEAN
Key to the project bean (
ProjectBean instance). |
static String |
CONTEXT_REPORT_ELEMENT |
static String |
CONTEXT_REPORT_ELEMENT_LIST |
static String |
CONTEXT_RFB_EVENT_LIST
Deprecated.
|
static String |
CONTEXT_SAFEBOX
Key of a context object - the schedule owning the executing script.
|
static String |
CONTEXT_SCRIPT_MANAGER
Key to a repository object - script handler.
|
static String |
CONTEXT_SELECTED_DOCUMENT_ELEMENT
Key to a repository object - a flag indicating whether the current line of code can be executed or not
|
static String |
CONTEXT_STOP_REASON
Key to a repository object - a reason (String) describing why script
execution was stopped.
|
static String |
CONTEXT_SUPPRESS_CLI_OUTPUT_FLAG
Key of a context flag indicating whether the syntax errors should be printed
out into the console (flag missing or flag=false) or not (flag=true).
|
static String |
CONTEXT_TEMPLATE_META_DATA
Key of a context object - last used template image meta data.
|
static String |
CONTEXT_TEMPLATE_PATH_ELEMENT |
static String |
CONTEXT_TIMER_MANAGER
Key of a context object - timer manager (since 2.3).
|
static String |
CONTEXT_TPP_INTEGRATION_PARAM_MAP
Key to the map of T-Plan Professional integration parameters.
|
static String |
CONTEXT_USER_CONFIGURATION
Key to a repository object - user configuration
|
static String |
CONTEXT_VARIABLE_MAP
Key to a repository object - script variables.
|
static String |
IMPLICIT_VARIABLE_BROWSER_CONTINUE |
static String |
IMPLICIT_VARIABLE_CLICK_CONTINUE |
static String |
IMPLICIT_VARIABLE_CURDATE |
static String |
IMPLICIT_VARIABLE_CURDATE_FORMAT |
static String |
IMPLICIT_VARIABLE_CURTIME |
static String |
IMPLICIT_VARIABLE_DATESTAMP |
static String |
IMPLICIT_VARIABLE_DESKTOP_HEIGHT |
static String |
IMPLICIT_VARIABLE_DESKTOP_WIDTH |
static String |
IMPLICIT_VARIABLE_DISPLAY |
static String |
IMPLICIT_VARIABLE_DISPLAY_COUNT |
static String |
IMPLICIT_VARIABLE_DISPLAY_H |
static String |
IMPLICIT_VARIABLE_DISPLAY_W |
static String |
IMPLICIT_VARIABLE_DISPLAY_X |
static String |
IMPLICIT_VARIABLE_DISPLAY_Y |
static String |
IMPLICIT_VARIABLE_DRAG_CONTINUE |
static String |
IMPLICIT_VARIABLE_EXECUTION_SPEED_FACTOR |
static String |
IMPLICIT_VARIABLE_EXIT_CODE |
static String |
IMPLICIT_VARIABLE_EXIT_FAILED_ARGUMENT |
static String |
IMPLICIT_VARIABLE_EXIT_FAILED_CMD |
static String |
IMPLICIT_VARIABLE_EXIT_FAILED_LINE |
static String |
IMPLICIT_VARIABLE_EXIT_FAILED_PARAMS |
static String |
IMPLICIT_VARIABLE_EXIT_FAILED_SCRIPT |
static String |
IMPLICIT_VARIABLE_EXIT_FAILED_TEMPLATE_SIZES |
static String |
IMPLICIT_VARIABLE_EXIT_FAILED_TEMPLATES |
static String |
IMPLICIT_VARIABLE_EXIT_SCREENSHOT |
static String |
IMPLICIT_VARIABLE_FILE_NAME |
static String |
IMPLICIT_VARIABLE_FILE_NAME_SHORT |
static String |
IMPLICIT_VARIABLE_FILE_PATH_SEPARATOR
The file path separator variable name (since 3.4.2).
|
static String |
IMPLICIT_VARIABLE_FILE_SEPARATOR
The file separator variable name (since 3.4.2).
|
static String |
IMPLICIT_VARIABLE_GEOMETRY
The target desktop size (since 4.0.2).
|
static String |
IMPLICIT_VARIABLE_INSTALL_DIR |
static String |
IMPLICIT_VARIABLE_JAVA_VENDOR
Java vendor (since 6.1.2)
|
static String |
IMPLICIT_VARIABLE_JAVA_VERSION
Java version (since 6.1.2)
|
static String |
IMPLICIT_VARIABLE_LAST_CMP_COMMAND
Last image comparison command (since 4.4.2)
|
static String |
IMPLICIT_VARIABLE_LAST_COMMAND |
static String |
IMPLICIT_VARIABLE_MACHINE_NAME |
static String |
IMPLICIT_VARIABLE_MOUSE_X |
static String |
IMPLICIT_VARIABLE_MOUSE_Y |
static String |
IMPLICIT_VARIABLE_PORT |
static String |
IMPLICIT_VARIABLE_PROCEDURE_ARGUMENT_COUNT |
static String |
IMPLICIT_VARIABLE_PRODUCT_HOME_PAGE |
static String |
IMPLICIT_VARIABLE_PRODUCT_INSTALL_DIR |
static String |
IMPLICIT_VARIABLE_PRODUCT_NAME |
static String |
IMPLICIT_VARIABLE_PRODUCT_VERSION_LONG |
static String |
IMPLICIT_VARIABLE_PRODUCT_VERSION_SHORT |
static String |
IMPLICIT_VARIABLE_PROTOCOL |
static String |
IMPLICIT_VARIABLE_RANDOM |
static String |
IMPLICIT_VARIABLE_RANDOM_MAX |
static String |
IMPLICIT_VARIABLE_RANDOM_MIN |
static String |
IMPLICIT_VARIABLE_REPORT_DIR |
static String |
IMPLICIT_VARIABLE_RGB |
static String |
IMPLICIT_VARIABLE_RGB_X |
static String |
IMPLICIT_VARIABLE_RGB_Y |
static String |
IMPLICIT_VARIABLE_SCHEDULE_SEQ_NO |
static String |
IMPLICIT_VARIABLE_SCRIPT_DIR |
static String |
IMPLICIT_VARIABLE_SEARCH2_MAX_MATCHES |
static String |
IMPLICIT_VARIABLE_SEQ_NO |
static String |
IMPLICIT_VARIABLE_SERVER_CLIPBOARD_CONTENT |
static String |
IMPLICIT_VARIABLE_SERVER_CLIPBOARD_CONTENT_TEXT |
static String |
IMPLICIT_VARIABLE_SYSTEM_ARCITECTURE
OS version (since 6.1.2)
|
static String |
IMPLICIT_VARIABLE_SYSTEM_NAME
OS name (since 6.1.2)
|
static String |
IMPLICIT_VARIABLE_SYSTEM_VERSION
OS version (since 6.1.2)
|
static String |
IMPLICIT_VARIABLE_TEMPLATE_DIR |
static String |
IMPLICIT_VARIABLE_THREAD_ID
The executing script thread name (since 3.5).
|
static String |
IMPLICIT_VARIABLE_TIMESTAMP |
static String |
IMPLICIT_VARIABLE_URL |
static String |
IMPLICIT_VARIABLE_WARNING_COUNT |
static String |
REPORT_REPORT_DESC |
static String |
REPORT_REPORT_FILE |
static String |
REPORT_REPORT_FILENAME |
static String |
REPORT_REPORT_RELATIVE_FILE |
static String |
REPORT_STATUS_IMAGE_NAME |
static String |
TRAILING_BACKSLASH_KEYWORD
Keyword representing a back slash in the parsed code.
|
static String |
WAITUNTIL_H |
static String |
WAITUNTIL_TIMEOUT |
static String |
WAITUNTIL_W |
static String |
WAITUNTIL_X |
static String |
WAITUNTIL_Y |
Modifier and Type | Method and Description |
---|---|
void |
addObjectListener(String key,
PropertyChangeListener l) |
void |
dispose()
Dispose (destroy) this context.
|
boolean |
equals(Object variable1,
Object variable2)
This method is provided to ensure compatibility of boolean expressions
converted from the scripting language.
|
RemoteDesktopClient |
getClient()
Get remote desktop client used for automation.
|
Map<String,String> |
getCommandLineVariables()
Get the map of override variables.
|
Number |
getComparisonResult()
Get a number representing result of the last performed image comparison
performed through the CompareTo or Screenshot commands.
|
List<SyntaxErrorException> |
getCompilationErrors()
Get the list of compilation errors in form of
SyntaxErrorException
instances. |
UserConfiguration |
getConfiguration()
Get user configuration (preferences).
|
Throwable |
getConnectError()
Get the most recent throwable resulting from an attempt to connect to
a desktop.
|
Component |
getEventSource()
Get a dummy event source.
|
ScriptLogger |
getExecutionLog()
Get the execution log.
|
int |
getExitCode()
Get exit code of the last executed command.
|
TestScriptInterpret |
getInterpret()
Get the test script interpret associated with this context.
|
TestScriptInterpret |
getMasterInterpret()
Get the master test script interpret (the top level one) associated
with this context.
|
TestWrapper |
getMasterWrapper()
Get the master test wrapper.
|
Point |
getObjectSearchHit(int index)
Get the top left corner from the object search match of the specified index.
|
List<Rectangle> |
getObjectSearchRects()
Get the list of rectangles located through the Object Search image comparison
method.
|
List<Shape> |
getObjectSearchShapes()
Get the list of shapes located through the Object Search image comparison
method.
|
File |
getOutputDir()
Get the output directory.
|
List<OutputObject> |
getOutputObjects()
Get the list of output objects.
|
TokenParser |
getParser()
Get an instance of the text parser.
|
com.tplan.robot.scripting.project.ProjectBean |
getProject()
Get the currently opened project.
|
String |
getRecognizedText(Rectangle textRectangle)
Get the last text recognized from the desktop screen either using an OCR
engine (such as the Tesseract OCR comparison method)
or the Image Based Text Recognition.
|
Point |
getRecognizedTextClickPoint()
Get the center of the string located by the OCR.
|
LinkedHashMap<String,Rectangle> |
getRecognizedTextElements()
Get the map of text elements and their location in form of Rectangle objects
from the last text recognized from the desktop screen either using an OCR
engine or a similar image comparison method.
|
Color |
getRGB(int x,
int y)
Get the RGB color at the specified coordinates of the connected desktop.
|
String |
getRGBAsString(int x,
int y)
Get the RGB color at the specified coordinates of the connected desktop
in the 6-char HTML format (white="ffffff").
|
ScriptManager |
getScriptManager()
Get script handler associated with this context.
|
Map |
getScriptParams()
Get the map of script parameters.
|
Point |
getSearchHitClickPoint()
Get the click point of the matching template image from the last image search.
|
Point |
getSearchHitClickPoint(int index)
Get the click point of matching template image of a particular index from
the last image search.It is an absolute point on the screen which defines
where to click on the match area.
|
List<Point> |
getSearchHits()
Get coordinates of template image occurences resulting from image comparison
performed through the
"search" method. |
Point |
getSearchHitSourcePoint()
Get the source point of the matching template image from the last image search.
|
File |
getSearchHitTemplateFile()
Get file of the matching template image in the last image search.
|
int |
getSearchHitTemplateIndex()
Get index of the matching template image from the last image search.
|
TemplateImageBean |
getSearchHitTemplateMetaData()
Get meta data container of the matching template image in the last image search.
|
Dimension |
getSearchHitTemplateSize()
Get size of the matching template image from the last image search.
|
List<Rectangle> |
getSearchRects()
Get the list of rectangular areas matched by the image search algorithm.
|
int |
getSeqNo()
Get the unique context's sequence number.
|
String |
getServerClipboardContent()
Get the latest clipboard text received from the desktop server.
|
String |
getServerClipboardContentAsText()
Get the latest clipboard text as received from the desktop server as
plain text.
|
File |
getTemplateDir()
Get the template directory.
|
Long |
getTimerValue(String timerName)
Get current value of a timer in milliseconds.
|
Object |
getVariable(String variableName)
Get value of a context variable.
|
Boolean |
getVariableAsBoolean(String variableName)
Convenience method to get a context variable as Boolean.
|
Color |
getVariableAsColor(String variableName)
Convenience method to get a context variable as Color.
|
Float |
getVariableAsFloat(String variableName)
Convenience method to get a context variable as Float number.
|
Integer |
getVariableAsInt(String variableName)
Convenience method to get a context variable as Integer number.
|
Point |
getVariableAsPoint(String variableName)
Convenience method to get a context variable as Point.
|
Rectangle |
getVariableAsRectangle(String variableName)
Convenience method to get a context variable as Rectangle.
|
String |
getVariableAsString(String variableName)
Convenience method to get a context variable as String.
|
ListenerMap<String,Object> |
getVariables()
Get the raw map of variables associated with this context.
|
boolean |
isCompilationContext()
Indicate whether this context as a compilation one or execution one.
|
boolean |
isCompilationFinished()
Find out if the compilation process using this context has finished.
|
boolean |
isStructureRequired()
Indicates whether the script structure data should be created during
the compilation process.
|
Boolean |
isTimerRunning(String timerName)
Find out whether a timer exists and is running (measuring time).
|
boolean |
recordComment(Element comment)
Record a comment to the comment collection facility if it is supported
and enabled.
|
void |
removeObjectListener(PropertyChangeListener l) |
void |
removeVariables(Object... names)
Remove variables that meet the given name(s) (String arguments) or
matches the given regular expression (s) (
Pattern
arguments).If the name is a String and contains the parameter
{0} it will be replaced with numbers starting from 0 using
MessageFormat and all variables that meet the name will
be removed. |
String |
resolveVariable(String name)
Look up the variable value.
|
void |
setOutputDir(File directory)
Set the output directory.
|
void |
setTemplateDir(File directory)
Set the template directory.
|
void |
setVariable(String variableName,
Object value)
Set a context variable.
|
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
static final String CONTEXT_CLIENT
static final String CONTEXT_COMPILER_PROGRESS
static final String CONTEXT_PARSER
static final String CONTEXT_VARIABLE_MAP
static final String CONTEXT_PROCEDURE_ARG_MAP
static final String CONTEXT_SCRIPT_MANAGER
static final String CONTEXT_CLI_VARIABLE_MAP
static final String CONTEXT_OUTPUT_OBJECTS
static final String CONTEXT_CURRENT_DOCUMENT_ELEMENT
static final String CONTEXT_CURRENT_DOCUMENT_ELEMENT_TEXT
static final String CONTEXT_LAST_EXECUTED_DOCUMENT_ELEMENT
static final String CONTEXT_RFB_EVENT_LIST
static final String CONTEXT_EXECUTION_START_DATE
static final String CONTEXT_CURRENT_SCRIPT_WRAPPER
static final String CONTEXT_MASTER_SCRIPT_WRAPPER
static final String CONTEXT_PROCEDURE_MAP
static final String CONTEXT_COMPILATION_FLAG
static final String CONTEXT_STOP_REASON
static final String CONTEXT_PAUSE_REASON
static final String CONTEXT_PROGRAMMATIC_PAUSE_FLAG
static final String CONTEXT_COMPILATION_ERRORS
static final String CONTEXT_LABEL_MAP
static final String CONTEXT_USER_CONFIGURATION
static final String CONTEXT_PROCEDURE_DECLARATION_FLAG
static final String CONTEXT_GOTO_TARGET_LABEL
static final String CONTEXT_SELECTED_DOCUMENT_ELEMENT
static final String CONTEXT_IMAGE_SEARCH_POINT_LIST
static final String CONTEXT_EXECUTION_DURATION
static final String CONTEXT_EVENT_SOURCE
static final String CONTEXT_INTERPRET
static final String CONTEXT_CONNECT_THROWABLE
static final String CONTEXT_TEMPLATE_META_DATA
static final String CONTEXT_MASTER_INTERPRET
static final String CONTEXT_TIMER_MANAGER
static final String CONTEXT_DO_NOT_DESTROY_FLAG
static final String CONTEXT_DEBUG_MODE_FLAG
static final String CONTEXT_COMMENT_LIST
static final String CONTEXT_CODE_LINE_COUNTER
static final String CONTEXT_LAST_GENERATED_CLIENT_EVENT
static final String CONTEXT_EXECUTION_ERROR
static final String CONTEXT_EXECUTION_LOG
static final String CONTEXT_OCR_LAST_TEXT
static final String CONTEXT_OCR_LAST_TEXT_RECT
static final String CONTEXT_OCR_LAST_TEXT_MAP
static final String CONTEXT_SUPPRESS_CLI_OUTPUT_FLAG
static final String CONTEXT_PARTIAL_EXECUTION_END_REACHED
static final String CONTEXT_TPP_INTEGRATION_PARAM_MAP
static final String CONTEXT_OWNING_SCHEDULE
static final String CONTEXT_SAFEBOX
static final String TRAILING_BACKSLASH_KEYWORD
static final String CONTEXT_PROJECT_BEAN
ProjectBean
instance). See the getProject()
method.static final String CONTEXT_REPORT_ELEMENT
static final String CONTEXT_REPORT_ELEMENT_LIST
static final String CONTEXT_TEMPLATE_PATH_ELEMENT
static final String CONTEXT_OUTPUT_PATH_ELEMENT
static final String IMPLICIT_VARIABLE_FILE_NAME
static final String IMPLICIT_VARIABLE_FILE_NAME_SHORT
static final String IMPLICIT_VARIABLE_TIMESTAMP
static final String IMPLICIT_VARIABLE_DATESTAMP
static final String IMPLICIT_VARIABLE_MACHINE_NAME
static final String IMPLICIT_VARIABLE_PORT
static final String IMPLICIT_VARIABLE_PROTOCOL
static final String IMPLICIT_VARIABLE_URL
static final String IMPLICIT_VARIABLE_DISPLAY
static final String IMPLICIT_VARIABLE_REPORT_DIR
static final String IMPLICIT_VARIABLE_TEMPLATE_DIR
static final String IMPLICIT_VARIABLE_SCRIPT_DIR
static final String IMPLICIT_VARIABLE_EXIT_CODE
static final String IMPLICIT_VARIABLE_DESKTOP_WIDTH
static final String IMPLICIT_VARIABLE_DESKTOP_HEIGHT
static final String IMPLICIT_VARIABLE_DISPLAY_COUNT
static final String IMPLICIT_VARIABLE_DISPLAY_X
static final String IMPLICIT_VARIABLE_DISPLAY_Y
static final String IMPLICIT_VARIABLE_DISPLAY_W
static final String IMPLICIT_VARIABLE_DISPLAY_H
static final String IMPLICIT_VARIABLE_WARNING_COUNT
static final String IMPLICIT_VARIABLE_SERVER_CLIPBOARD_CONTENT
static final String IMPLICIT_VARIABLE_SERVER_CLIPBOARD_CONTENT_TEXT
static final String IMPLICIT_VARIABLE_CURTIME
static final String IMPLICIT_VARIABLE_CURDATE
static final String IMPLICIT_VARIABLE_CURDATE_FORMAT
static final String IMPLICIT_VARIABLE_MOUSE_X
static final String IMPLICIT_VARIABLE_MOUSE_Y
static final String IMPLICIT_VARIABLE_RANDOM
static final String IMPLICIT_VARIABLE_RANDOM_MIN
static final String IMPLICIT_VARIABLE_RANDOM_MAX
static final String IMPLICIT_VARIABLE_RGB
static final String IMPLICIT_VARIABLE_RGB_X
static final String IMPLICIT_VARIABLE_RGB_Y
static final String IMPLICIT_VARIABLE_PROCEDURE_ARGUMENT_COUNT
static final String IMPLICIT_VARIABLE_PRODUCT_VERSION_SHORT
static final String IMPLICIT_VARIABLE_PRODUCT_VERSION_LONG
static final String IMPLICIT_VARIABLE_PRODUCT_NAME
static final String IMPLICIT_VARIABLE_PRODUCT_HOME_PAGE
static final String IMPLICIT_VARIABLE_PRODUCT_INSTALL_DIR
static final String IMPLICIT_VARIABLE_EXECUTION_SPEED_FACTOR
static final String IMPLICIT_VARIABLE_FILE_SEPARATOR
static final String IMPLICIT_VARIABLE_FILE_PATH_SEPARATOR
static final String IMPLICIT_VARIABLE_THREAD_ID
static final String IMPLICIT_VARIABLE_GEOMETRY
static final String IMPLICIT_VARIABLE_LAST_CMP_COMMAND
static final String IMPLICIT_VARIABLE_JAVA_VENDOR
static final String IMPLICIT_VARIABLE_JAVA_VERSION
static final String IMPLICIT_VARIABLE_SYSTEM_NAME
static final String IMPLICIT_VARIABLE_SYSTEM_VERSION
static final String IMPLICIT_VARIABLE_SYSTEM_ARCITECTURE
static final String WAITUNTIL_X
static final String WAITUNTIL_Y
static final String WAITUNTIL_W
static final String WAITUNTIL_H
static final String WAITUNTIL_TIMEOUT
static final String REPORT_REPORT_FILE
static final String REPORT_REPORT_FILENAME
static final String REPORT_REPORT_RELATIVE_FILE
static final String REPORT_REPORT_DESC
static final String REPORT_STATUS_IMAGE_NAME
static final String COMPARETO_RESULT
static final String COMPARETO_PASS_RATE
static final String COMPARETO_TEMPLATE
static final String COMPARETO_TIME_IN_MS
static final String COMPARETO_TEMPLATE_INDEX
static final String COMPARETO_TEMPLATE_WIDTH
static final String COMPARETO_TEMPLATE_HEIGHT
static final String COMPARETO_SOURCE_X
static final String COMPARETO_SOURCE_Y
static final String COMPARETO_CLICK_X
static final String COMPARETO_CLICK_Y
static final String COMPARETO_DISPLAY_NO
static final String COMPARETO_SORT_MODE
static final String IMPLICIT_VARIABLE_INSTALL_DIR
static final String IMPLICIT_VARIABLE_SEQ_NO
static final String IMPLICIT_VARIABLE_SCHEDULE_SEQ_NO
static final String IMPLICIT_VARIABLE_EXIT_FAILED_CMD
static final String IMPLICIT_VARIABLE_EXIT_FAILED_PARAMS
static final String IMPLICIT_VARIABLE_EXIT_FAILED_ARGUMENT
static final String IMPLICIT_VARIABLE_EXIT_FAILED_LINE
static final String IMPLICIT_VARIABLE_EXIT_FAILED_SCRIPT
static final String IMPLICIT_VARIABLE_EXIT_FAILED_TEMPLATES
static final String IMPLICIT_VARIABLE_EXIT_FAILED_TEMPLATE_SIZES
static final String IMPLICIT_VARIABLE_EXIT_SCREENSHOT
static final String IMPLICIT_VARIABLE_SEARCH2_MAX_MATCHES
static final String IMPLICIT_VARIABLE_CLICK_CONTINUE
static final String IMPLICIT_VARIABLE_DRAG_CONTINUE
static final String IMPLICIT_VARIABLE_LAST_COMMAND
static final String IMPLICIT_VARIABLE_BROWSER_CONTINUE
RemoteDesktopClient getClient()
UserConfiguration getConfiguration()
ScriptManager getScriptManager()
Map getScriptParams()
void setVariable(String variableName, Object value)
Set a context variable.
The context stores a map of
variables ([variable_name, variable_alue] pairs) under the CONTEXT_VARIABLE_MAP
key.
While the Var and Eval commands create entries
in this map, a preprocessor of the proprietary test script interpret
ProprietaryTestScriptInterpret
makes sure that any variable reference
in form of {variable_name}
in a test script command line
gets replaced with the variable value before further processing.
The variable map is available through the getVariables()
method.
As it is a ListenerMap
instance, anyone may
register for variable change events through the ListenerMap.addPropertyChangeListener(java.beans.PropertyChangeListener)
listener interface.
variableName
- a variable name (case sensitive).value
- variable value, usually a String (created through Var
)
or a Number (typically defined by Eval
) instance.Object getVariable(String variableName)
Get value of a context variable.
The context stores a map of
variables ([variable_name, variable_alue] pairs) under the CONTEXT_VARIABLE_MAP
key.
While the Var and Eval commands create entries
in this map, a preprocessor of the proprietary test script interpret
ProprietaryTestScriptInterpret
makes sure that any variable reference
in form of {variable_name}
in a test script command line
gets replaced with the variable value before further processing.
The variable map is available through the getVariables()
method.
As it is a ListenerMap
instance, anyone may
register for variable change events through the ListenerMap.addPropertyChangeListener(java.beans.PropertyChangeListener)
listener interface.
variableName
- a case sensitive variable name to retrieve the value of.Var
)
or a Number (typically defined by Eval
) instance. The method returns
null if the variable doesn't exist.Integer getVariableAsInt(String variableName)
getVariable(java.lang.String)
)
and converts it to integer using the methods of the shared parser (see getParser()
).variableName
- variable name (case sensitive).IllegalArgumentException
.
If the variable doesn't exist, the method returns null.Float getVariableAsFloat(String variableName)
getVariable(java.lang.String)
)
and converts it to float using the methods of the shared parser (see getParser()
).variableName
- variable name (case sensitive).IllegalArgumentException
.
If the variable doesn't exist, the method returns null.Boolean getVariableAsBoolean(String variableName)
getVariable(java.lang.String)
)
and converts it to boolean using the methods of the shared parser (see getParser()
).variableName
- variable name (case sensitive).IllegalArgumentException
.
If the variable doesn't exist, the method returns null.String getVariableAsString(String variableName)
getVariable(java.lang.String)
)
and converts it to string using the Object.toString()
method..variableName
- variable name (case sensitive).Point getVariableAsPoint(String variableName)
getVariable(java.lang.String)
)
and makes an attempt to convert it to a Point
using
the shared parser (see getParser()
). The variable value format must be compliant
with the Point expression described in the scripting language specification. For example,
a point of (10,20) is represented by a value like "x:10,y:20".variableName
- variable name (case sensitive).IllegalArgumentException
.
If the variable doesn't exist, the method returns null.Rectangle getVariableAsRectangle(String variableName)
getVariable(java.lang.String)
)
and makes an attempt to convert it to a Rectangle
using
the shared parser (see getParser()
). The variable value format must be compliant
with the Rectangle expression described in the scripting language specification. For example,
a rectangle with the left upper corner at (10,20) and the size (width,height) equal
to (100,200) is represented by a value like "x:10,y:20,w:100,h:200".variableName
- variable name (case sensitive).IllegalArgumentException
.
If the variable doesn't exist, the method returns null.Color getVariableAsColor(String variableName)
getVariable(java.lang.String)
)
and makes an attempt to convert it to a Color
using
the shared parser (see getParser()
). The variable value format must be compliant
with the HTML-like color expression format described in the scripting language specification. For example,
a color of (R,G,B) equal to (0,128,256) is represented by a value like "0080FF".variableName
- variable name (case sensitive).IllegalArgumentException
.
If the variable doesn't exist, the method returns null.ListenerMap<String,Object> getVariables()
Get the raw map of variables associated with this context.
The context stores a map of
variables ([variable_name, variable_alue] pairs) under the CONTEXT_VARIABLE_MAP
key.
While the Var and Eval commands create entries
in this map, a preprocessor of the proprietary test script interpret
ProprietaryTestScriptInterpret
makes sure that any variable reference
in form of {variable_name}
in a test script command line
gets replaced with the variable value before further processing.
The variable map is available through the getVariables()
method.
As it is a ListenerMap
instance, anyone may
register for variable change events through the ListenerMap.addPropertyChangeListener(java.beans.PropertyChangeListener)
listener interface.
boolean equals(Object variable1, Object variable2)
true
if the objects represent equal numbers (even in form of
String instances) or if the objects are equal strings.
For example, equals("3", "3.0")
will return true because the
both arguments may be converted to numbers whose values are equal.variable1
- first variable value.variable2
- another variable value.int getExitCode()
File getOutputDir()
Get the output directory. It is a folder where output objects such as screen shots, files and reports should be saved to unless the test script code specifies otherwise (for example through specifying an output object with an absolute path pointing somewhere else).
Default value returned by the method is the user home folder obtained from the JVM system
properties as System.getProperty("user.dir")
. This default
value may be overriden through the scripting.defaultOutputPath
user preference. See the UserConfiguration
class for more.
The output path may be customized for a particular test script programatically
through the setOutputDir(java.io.File)
method or through setting of the _REPORT_DIR
context variable in a test script.
The new path is however not applied to the objects which have been created
before the change. To make sure that all output goes to one custom directory set the
output path at the very beginning of your test script.
As the method is just a convenience method which returns value of the
_REPORT_DIR
context variable, objects interested in receiving
events about the path update may take advantage of the ListenerMap
interface of the map of context variables
to register
for the variable changes.
void setOutputDir(File directory)
Set the output directory. It is a folder where output objects such as screenshots, files and reports should be saved to unless the test script code specifies otherwise (for example through specifying an output object with an absolute path pointing somewhere else).
This is just a convenience method which sets the _REPORT_DIR
context variable through the setVariable(java.lang.String, java.lang.Object)
method.
A null value will reset the path to the default value described in the getOutputDir()
method.
Be aware that the new path is not applied to the objects which have been created before the change. To make sure that all output goes to one custom directory set the output path at the very beginning of your test script.
directory
- a new output path or null to reset the directory to the default value.File getTemplateDir()
Get the template directory. It is a folder where commands performing image comparison will look for template images unless the command parameter specifies the template with a full path.
Default value returned by the method is the user home folder obtained from the JVM system
properties as System.getProperty("user.dir")
. This default
value may be overriden through the scripting.defaultTemplatePath
user preference. See the UserConfiguration
class.
The template path may be customized for a particular test script programatically
through the setTemplateDir(java.io.File)
method or through setting of the _TEMPLATE_DIR
context variable
in the test script.
As the method is just a convenience method which returns value of the
_TEMPLATE_PATH
context variable, objects interested in receiving
events about the path update may take advantage of the ListenerMap
interface of the map of context variables
to register
for the variable changes.
void setTemplateDir(File directory)
Set the template directory. It is a folder where commands performing image comparison will look for template images unless the command parameter specifies the template with a full path.
This is just a convenience method which sets the _TEMPLATE_DIR
context variable through the setVariable(java.lang.String, java.lang.Object)
method.
A null value will reset the path to the default value described in the getTemplateDir()
method.
directory
- a new path to read template images from.String getServerClipboardContent()
Get the latest clipboard text received from the desktop server. This is
just a convenience method which returns value of the _SERVER_CLIPBOARD_CONTENT
context variable and it is equivalent to (String)getVariable("_SERVER_CLIPBOARD_CONTENT")
.
The method returns a non null method only if (1) a desktop is connected,
(2) both the desktop server and client support clipboard content transfer and
(3) the client has received which the user has cut or copied text on the desktop.
To find out whether the current client (getClient()
) supports clipboard
transfers at all check whether it implements the ClipboardTransferCapable
capability.
For example, an RFB (VNC) server does support clipboard transfer provided
that either the vncconfig
or other clipboard
handling utility (autocutsel, ...) is
running on the server. When user copies/cuts a text on the desktop using
Ctrl+C or Ctrl+X, it gets transferred to the client which is expected to update the
_SERVER_CLIPBOARD_CONTENT
context variable.
To wait for a clipboard change in a test script use the Waitfor clipboard command.
To register programatically as a listener for clipboard changes either use the
RemoteDesktopClient.addServerListener(com.tplan.robot.remoteclient.RemoteDesktopServerListener)
interface and check for the RemoteDesktopServerEvent.SERVER_CLIPBOARD_EVENT
event type, or
register as a listener to the variable map (see getVariables()
description).
The difference is that while one test script uses the same context during
the whole script execution, the client may change as with the connect and
disconnect command calls of the test script code.
String getServerClipboardContentAsText()
getServerClipboardContent()
save that if the returned text is an
HTML document or a chunk of HTML code it gets converted to plain text.List<Point> getSearchHits()
Get coordinates of template image occurences resulting from image comparison
performed through the "search"
method. This list is populated by
the built-in image search plugin SearchImageComparisonModule
every
time its compare()
or
compareToBaseImage()
method
gets invoked.
This method belongs to convenience methods allowing to access image
search results on the Java API level. Image search is usually triggered
by one of the test script commands (methods) such as compareTo(),
screenshot(), waitForMatch() or waitForMismatch() from the DefaultJavaTestScript
class. The algorithm accepts one or more template images on input and
searches desktop of the currently connected client (see getClient()
)
for matching areas. The input images are processed one by one
in the order they were specified at and the search is stopped when
at least one match is found or the end of the image list is achieved.
Result of image search is primarily expressed by the calling method's
numeric exit code and additional information (such as match coordinates and
matching template details) are stored to the context in form of variables
(see the getVariable(java.lang.String)
method). To avoid casting
and conversion of variables to numeric values the context provides the
following set of convenience methods:
getComparisonResult()
returns in case of image search either
0 (meaning "no matches found") or 100 (meaning "at least one match was found").getSearchHits()
returns the list of match locations (left upper
corner of the match area on the desktop).getSearchHitTemplateIndex()
returns index of the matching
template in the input list.getSearchHitTemplateFile()
returns the matching template file (if available).getSearchHitTemplateSize()
returns size (width and height)
of the matching template.getSearchHitTemplateMetaData()
returns the image meta data container.List<Rectangle> getSearchRects()
getSearchHits()
method where each match location (Point instance)
is combined with the matching template image size returned by getSearchHitTemplateSize()
to produce a Rectangle representing the matching area on the screen.int getSearchHitTemplateIndex()
getSearchHits()
method documentation for more.Dimension getSearchHitTemplateSize()
getSearchHits()
method documentation for more.Point getSearchHitClickPoint()
Get the click point of the matching template image from the last image search. It is an absolute point on the screen which defines where to click on the match area. It usually defaults to the template image center.
Do not confuse this method with the TemplateImageBean.getClickPoint()
one which returns relative [x, y] in the template image coordinate system.
The getSearchHitClickPoint()
rather returns a "ready to be used"
click point which was calculated with regard to the specific match location.
Point getSearchHitClickPoint(int index)
Get the click point of matching template image of a particular index from the last image search.It is an absolute point on the screen which defines where to click on the match area. It usually defaults to the template image center.
Do not confuse this method with the
TemplateImageBean.getClickPoint()
one which returns relative [x,
y] in the template image coordinate system. The
getSearchHitClickPoint()
rather returns a "ready to be used"
click point which was calculated with regard to the specific match
location.
index
- index of the search match.Point getSearchHitSourcePoint()
File getSearchHitTemplateFile()
DefaultJavaTestScript.compareTo(java.awt.Image[], com.tplan.robot.imagecomparison.ImageComparisonModule, float, java.awt.Rectangle)
method).TemplateImageBean getSearchHitTemplateMetaData()
getSearchHits()
method documentation for more.DefaultJavaTestScript.compareTo(java.awt.Image[], com.tplan.robot.imagecomparison.ImageComparisonModule, float, java.awt.Rectangle)
method).Number getComparisonResult()
Get a number representing result of the last performed image comparison performed through the CompareTo or Screenshot commands. It is a number between 0 and 100 representing percentage of how much the two compared images matched. The value is subject to the image comparison method used; image search for example returns either 0 (meaning "no matches found") or 100 (meaning "at least one match was found") while the "default" histogram based method returns any number between 0 and 100 reflecting the percentage of matching pixels.
List<Shape> getObjectSearchShapes()
Shape.getBounds()
method.List<Rectangle> getObjectSearchRects()
getObjectSearchShapes()
method where each Shape is converted to a
rectangle using Shape.getBounds()
.Point getObjectSearchHit(int index)
ArrayIndexOutOfBoundsException
if the index is >=
the number of matches.index
- index (the first match has the index of 0).TokenParser getParser()
Component getEventSource()
java.awt.Component
event source in the constructor, the component returned by this method is
used as event source by some framework classes which use the Java event
system but are not Component instances.TestWrapper getMasterWrapper()
ScriptWrapper
instance (when the
test script is a proprietary one) or DefaultJavaTestScript
when the test script is a Java one.Map<String,String> getCommandLineVariables()
-v/--variable
command line parameters. They override values
of variables specified in scripts. See the CLI Options documentation on
how to override script variables.TestScriptInterpret getInterpret()
TestScriptInterpret getMasterInterpret()
List<SyntaxErrorException> getCompilationErrors()
SyntaxErrorException
instances.List<OutputObject> getOutputObjects()
Throwable getConnectError()
boolean isCompilationContext()
void dispose()
Long getTimerValue(String timerName)
Get current value of a timer in milliseconds. If the timer doesn't exist (meaning
it hasn't been created by a call of Timer command or a call of
DefaultJavaTestScript.timer(java.lang.String, java.lang.String, java.lang.String, long, long, java.lang.String, java.lang.String, java.io.File)
or any other similar timer method), the method returns null.
To format the value into a displayable string you may take advantage
of Utils.getTimePeriodForDisplay(long, boolean)
, Utils.getTimePeriodForDisplay(long, boolean, boolean)
or Utils.getTimePeriodForDisplay(long, boolean, boolean, boolean)
.
timerName
- timer name (case sensitive).Boolean isTimerRunning(String timerName)
DefaultJavaTestScript.timer(java.lang.String, java.lang.String, java.lang.String, long, long, java.lang.String, java.lang.String, java.io.File)
or any other similar timer method), the method returns null. Otherwise the
method returns a valid Boolean value indicating whether the timer is started or not.timerName
- timer name (case sensitive).boolean recordComment(Element comment)
comment
- a comment.ScriptLogger getExecutionLog()
Color getRGB(int x, int y)
ArrayIndexOutOfBoundsException
if the coordinates are out of bounds.x
- the X-coordinate within [0, desktopWidth-1].y
- the Y-coordinate within [0, desktopHeight-1].String getRGBAsString(int x, int y)
ArrayIndexOutOfBoundsException
if the coordinates are out of bounds.x
- the X-coordinate within [0, desktopWidth-1].y
- the Y-coordinate within [0, desktopHeight-1].void addObjectListener(String key, PropertyChangeListener l)
void removeObjectListener(PropertyChangeListener l)
String getRecognizedText(Rectangle textRectangle)
textRectangle
- optional Rectangle instance to store the text rectangle to. If the
source OCR doesn't support extraction of the text coordinates it will set
the rectangle width and height to 0.LinkedHashMap<String,Rectangle> getRecognizedTextElements()
Point getRecognizedTextClickPoint()
getRecognizedText(java.awt.Rectangle)
method.com.tplan.robot.scripting.project.ProjectBean getProject()
int getSeqNo()
String resolveVariable(String name)
name
- a variable name.boolean isStructureRequired()
boolean isCompilationFinished()
void removeVariables(Object... names)
Pattern
arguments).If the name is a String and contains the parameter
{0}
it will be replaced with numbers starting from 0 using
MessageFormat
and all variables that meet the name will
be removed.names
- variable names of patterns.