T-Plan Robot Enterprise 4.0
Build No. 4.0-20140924.1

com.tplan.robot.scripting
Interface ScriptingContext

All Superinterfaces:
java.util.Map
All Known Implementing Classes:
ScriptingContextImpl

public interface ScriptingContext
extends java.util.Map

Scripting context is a map which serves as a repository of objects and structures related to script execution.


T-Plan Robot Enterprise, (C) 2009-2014 T-Plan Limited. All rights reserved.


Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
static java.lang.String COMPARETO_CLICK_X
           
static java.lang.String COMPARETO_CLICK_Y
           
static java.lang.String COMPARETO_PASS_RATE
           
static java.lang.String COMPARETO_RESULT
           
static java.lang.String COMPARETO_SORT_MODE
           
static java.lang.String COMPARETO_SOURCE_X
           
static java.lang.String COMPARETO_SOURCE_Y
           
static java.lang.String COMPARETO_TEMPLATE
           
static java.lang.String COMPARETO_TEMPLATE_HEIGHT
           
static java.lang.String COMPARETO_TEMPLATE_INDEX
           
static java.lang.String COMPARETO_TEMPLATE_WIDTH
           
static java.lang.String COMPARETO_TIME_IN_MS
           
static java.lang.String CONTEXT_CLI_VARIABLE_MAP
          Key to a repository object - script variables passed via CLI arguments.
static java.lang.String CONTEXT_CLIENT
          Key to a repository object - script variables.
static java.lang.String CONTEXT_CODE_LINE_COUNTER
          Key of a context object - a counter showing number of compiled/executed code lines.
static java.lang.String CONTEXT_COMMENT_LIST
          Key of a context object - list of collected comments (since 2.3.1).
static java.lang.String CONTEXT_COMPILATION_ERRORS
          Key to a repository object - list of validation errors, i.e.
static java.lang.String CONTEXT_COMPILATION_FLAG
          Key to a repository object - a flag showing whether this is a validation repository or an execution one.
static java.lang.String CONTEXT_CONNECT_THROWABLE
          Key of a context object - Throwable (exception) from a failed attempt to connect to a desktop.
static java.lang.String CONTEXT_CURRENT_DOCUMENT_ELEMENT
          Key to a repository object - currently executed document element.
static java.lang.String CONTEXT_CURRENT_SCRIPT_WRAPPER
          Key to a repository object - current script wrapper.
static java.lang.String CONTEXT_DEBUG_MODE_FLAG
          Key to a repository object - debug flag.
static java.lang.String CONTEXT_DO_NOT_DESTROY_FLAG
          Key of a context object - a flag blocking destroying of the context (since 2.3).
static java.lang.String CONTEXT_EVENT_SOURCE
          Key to a repository object - a Component instance which should be used as MouseEvent and KeyEvent source
static java.lang.String CONTEXT_EXECUTION_DURATION
          Key to a repository object - duration of script execution.
static java.lang.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 java.lang.String CONTEXT_EXECUTION_LOG
          Key of a context object holding the script status data.
static java.lang.String CONTEXT_EXECUTION_START_DATE
          Key to a repository object - execution start date & time.
static java.lang.String CONTEXT_GOTO_TARGET_LABEL
          Key to a repository object - labels of the GoTo command
static java.lang.String CONTEXT_IMAGE_SEARCH_POINT_LIST
          Key to a repository object - a List of coordinates resulted from an image search
static java.lang.String CONTEXT_INTERPRET
          Key of a context object - test script interpret.
static java.lang.String CONTEXT_LABEL_MAP
          Key to a repository object - labels of the GoTo command
static java.lang.String CONTEXT_LAST_EXECUTED_DOCUMENT_ELEMENT
          Key to a repository object - last executed document element.
static java.lang.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 java.lang.String CONTEXT_MASTER_INTERPRET
          Key of a context object - last used template image meta data.
static java.lang.String CONTEXT_MASTER_SCRIPT_WRAPPER
          Key to a repository object - master script wrapper.
static java.lang.String CONTEXT_OCR_LAST_TEXT
          Key of a context object containing the last recognized text by an OCR method or similar..
static java.lang.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 java.lang.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 java.lang.String CONTEXT_OUTPUT_OBJECTS
          Key to a repository object - list with output objects, i.e.
static java.lang.String CONTEXT_OUTPUT_PATH_ELEMENT
           
static java.lang.String CONTEXT_PARSER
          Key to a repository object - a List of coordinates resulted from an image search
static java.lang.String CONTEXT_PARTIAL_EXECUTION_END_REACHED
          Key of a context flag indicating that end of a selection execution has been reached.
static java.lang.String CONTEXT_PAUSE_REASON
          Key to a repository object - a reason (String) describing why script execution was paused.
static java.lang.String CONTEXT_PROCEDURE_ARG_MAP
          Key to a repository object - map with procedure arguments.
static java.lang.String CONTEXT_PROCEDURE_DECLARATION_FLAG
          Key to a repository object - a flag indicating whether we are in a procedure declaration or not
static java.lang.String CONTEXT_PROCEDURE_MAP
          Key to a repository object - procedure table.
static java.lang.String CONTEXT_PROJECT_BEAN
          Key to the project bean (ProjectBean instance).
static java.lang.String CONTEXT_REPORT_ELEMENT
           
static java.lang.String CONTEXT_REPORT_ELEMENT_LIST
           
static java.lang.String CONTEXT_RFB_EVENT_LIST
          Key to a repository object - list with events received from the RFB server.
static java.lang.String CONTEXT_SCRIPT_MANAGER
          Key to a repository object - script handler.
static java.lang.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 java.lang.String CONTEXT_STOP_REASON
          Key to a repository object - a reason (String) describing why script execution was stopped.
static java.lang.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 java.lang.String CONTEXT_TEMPLATE_META_DATA
          Key of a context object - last used template image meta data.
static java.lang.String CONTEXT_TEMPLATE_PATH_ELEMENT
           
static java.lang.String CONTEXT_TIMER_MANAGER
          Key of a context object - timer manager (since 2.3).
static java.lang.String CONTEXT_USER_CONFIGURATION
          Key to a repository object - user configuration
static java.lang.String CONTEXT_VARIABLE_MAP
          Key to a repository object - script variables.
static java.lang.String IMPLICIT_VARIABLE_CURDATE
           
static java.lang.String IMPLICIT_VARIABLE_CURDATE_FORMAT
           
static java.lang.String IMPLICIT_VARIABLE_CURTIME
           
static java.lang.String IMPLICIT_VARIABLE_DATESTAMP
           
static java.lang.String IMPLICIT_VARIABLE_DESKTOP_HEIGHT
           
static java.lang.String IMPLICIT_VARIABLE_DESKTOP_WIDTH
           
static java.lang.String IMPLICIT_VARIABLE_DISPLAY
           
static java.lang.String IMPLICIT_VARIABLE_EXECUTION_SPEED_FACTOR
           
static java.lang.String IMPLICIT_VARIABLE_EXIT_CODE
           
static java.lang.String IMPLICIT_VARIABLE_FILE_NAME
           
static java.lang.String IMPLICIT_VARIABLE_FILE_NAME_SHORT
           
static java.lang.String IMPLICIT_VARIABLE_FILE_PATH_SEPARATOR
          The file path separator variable name (since 3.4.2).
static java.lang.String IMPLICIT_VARIABLE_FILE_SEPARATOR
          The file separator variable name (since 3.4.2).
static java.lang.String IMPLICIT_VARIABLE_INSTALL_DIR
           
static java.lang.String IMPLICIT_VARIABLE_MACHINE_NAME
           
static java.lang.String IMPLICIT_VARIABLE_MOUSE_X
           
static java.lang.String IMPLICIT_VARIABLE_MOUSE_Y
           
static java.lang.String IMPLICIT_VARIABLE_PORT
           
static java.lang.String IMPLICIT_VARIABLE_PROCEDURE_ARGUMENT_COUNT
           
static java.lang.String IMPLICIT_VARIABLE_PRODUCT_HOME_PAGE
           
static java.lang.String IMPLICIT_VARIABLE_PRODUCT_INSTALL_DIR
           
static java.lang.String IMPLICIT_VARIABLE_PRODUCT_NAME
           
static java.lang.String IMPLICIT_VARIABLE_PRODUCT_VERSION_LONG
           
static java.lang.String IMPLICIT_VARIABLE_PRODUCT_VERSION_SHORT
           
static java.lang.String IMPLICIT_VARIABLE_PROTOCOL
           
static java.lang.String IMPLICIT_VARIABLE_RANDOM
           
static java.lang.String IMPLICIT_VARIABLE_RANDOM_MAX
           
static java.lang.String IMPLICIT_VARIABLE_RANDOM_MIN
           
static java.lang.String IMPLICIT_VARIABLE_REPORT_DIR
           
static java.lang.String IMPLICIT_VARIABLE_RGB
           
static java.lang.String IMPLICIT_VARIABLE_RGB_X
           
static java.lang.String IMPLICIT_VARIABLE_RGB_Y
           
static java.lang.String IMPLICIT_VARIABLE_SCRIPT_DIR
           
static java.lang.String IMPLICIT_VARIABLE_SERVER_CLIPBOARD_CONTENT
           
static java.lang.String IMPLICIT_VARIABLE_TEMPLATE_DIR
           
static java.lang.String IMPLICIT_VARIABLE_THREAD_ID
          The executing script thread name (since 3.5).
static java.lang.String IMPLICIT_VARIABLE_TIMESTAMP
           
static java.lang.String IMPLICIT_VARIABLE_URL
           
static java.lang.String IMPLICIT_VARIABLE_WARNING_COUNT
           
static java.lang.String REPORT_REPORT_DESC
           
static java.lang.String REPORT_REPORT_FILE
           
static java.lang.String REPORT_REPORT_FILENAME
           
static java.lang.String REPORT_STATUS_IMAGE_NAME
           
static java.lang.String WAITUNTIL_H
           
static java.lang.String WAITUNTIL_TIMEOUT
           
static java.lang.String WAITUNTIL_W
           
static java.lang.String WAITUNTIL_X
           
static java.lang.String WAITUNTIL_Y
           
 
Method Summary
 void addObjectListener(java.lang.String key, java.beans.PropertyChangeListener l)
           
 void dispose()
          Dispose (destroy) this context.
 boolean equals(java.lang.Object variable1, java.lang.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.
 java.util.Map<java.lang.String,java.lang.String> getCommandLineVariables()
          Get the map of override variables.
 java.lang.Number getComparisonResult()
          Get a number representing result of the last performed image comparison performed through the CompareTo or Screenshot commands.
 java.util.List<SyntaxErrorException> getCompilationErrors()
          Get the list of compilation errors in form of SyntaxErrorException instances.
 UserConfiguration getConfiguration()
          Get user configuration (preferences).
 java.lang.Throwable getConnectError()
          Get the most recent throwable resulting from an attempt to connect to a desktop.
 java.awt.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.
 java.awt.Point getObjectSearchHit(int index)
          Get the top left corner from the object search match of the specified index.
 java.util.List<java.awt.Rectangle> getObjectSearchRects()
          Get the list of rectangles located through the Object Search image comparison method.
 java.util.List<java.awt.Shape> getObjectSearchShapes()
          Get the list of shapes located through the Object Search image comparison method.
 java.io.File getOutputDir()
          Get the output directory.
 java.util.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.
 java.lang.String getRecognizedText(java.awt.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.
 java.awt.Point getRecognizedTextClickPoint()
          Get the center of the string located by the OCR.
 java.util.LinkedHashMap<java.lang.String,java.awt.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.
 java.awt.Color getRGB(int x, int y)
          Get the RGB color at the specified coordinates of the connected desktop.
 java.lang.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.
 java.util.Map getScriptParams()
          Get the map of script parameters.
 java.awt.Point getSearchHitClickPoint()
          Get the click point of the matching template image from the last image search.
 java.awt.Point getSearchHitClickPoint(int index)
          Get the click point of matching template image of a particular index from the last image search.
 java.util.List<java.awt.Point> getSearchHits()
          Get coordinates of template image occurences resulting from image comparison performed through the "search" method.
 java.awt.Point getSearchHitSourcePoint()
          Get the source point of the matching template image from the last image search.
 java.io.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.
 java.awt.Dimension getSearchHitTemplateSize()
          Get size of the matching template image from the last image search.
 java.util.List<java.awt.Rectangle> getSearchRects()
          Get the list of rectangular areas matched by the image search algorithm.
 int getSeqNo()
          Get the unique context's sequence number.
 java.lang.String getServerClipboardContent()
          Get the latest clipboard text received from the desktop server.
 java.io.File getTemplateDir()
          Get the template directory.
 java.lang.Long getTimerValue(java.lang.String timerName)
          Get current value of a timer in milliseconds.
 java.lang.Object getVariable(java.lang.String variableName)
          Get value of a context variable.
 java.lang.Boolean getVariableAsBoolean(java.lang.String variableName)
          Convenience method to get a context variable as Boolean.
 java.awt.Color getVariableAsColor(java.lang.String variableName)
          Convenience method to get a context variable as Color.
 java.lang.Float getVariableAsFloat(java.lang.String variableName)
          Convenience method to get a context variable as Float number.
 java.lang.Integer getVariableAsInt(java.lang.String variableName)
          Convenience method to get a context variable as Integer number.
 java.awt.Point getVariableAsPoint(java.lang.String variableName)
          Convenience method to get a context variable as Point.
 java.awt.Rectangle getVariableAsRectangle(java.lang.String variableName)
          Convenience method to get a context variable as Rectangle.
 java.lang.String getVariableAsString(java.lang.String variableName)
          Convenience method to get a context variable as String.
 ListenerMap<java.lang.String,java.lang.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.
 java.lang.Boolean isTimerRunning(java.lang.String timerName)
          Find out whether a timer exists and is running (measuring time).
 boolean recordComment(javax.swing.text.Element comment)
          Record a comment to the comment collection facility if it is supported and enabled.
 void removeObjectListener(java.beans.PropertyChangeListener l)
           
 void setOutputDir(java.io.File directory)
          Set the output directory.
 void setTemplateDir(java.io.File directory)
          Set the template directory.
 void setVariable(java.lang.String variableName, java.lang.Object value)
          Set a context variable.
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 

Field Detail

CONTEXT_CLIENT

static final java.lang.String CONTEXT_CLIENT
Key to a repository object - script variables. Script variables are defined by the Var command.

See Also:
Constant Field Values

CONTEXT_PARSER

static final java.lang.String CONTEXT_PARSER
Key to a repository object - a List of coordinates resulted from an image search

See Also:
Constant Field Values

CONTEXT_VARIABLE_MAP

static final java.lang.String CONTEXT_VARIABLE_MAP
Key to a repository object - script variables. Script variables are defined by the Var command.

See Also:
Constant Field Values

CONTEXT_PROCEDURE_ARG_MAP

static final java.lang.String CONTEXT_PROCEDURE_ARG_MAP
Key to a repository object - map with procedure arguments.

See Also:
Constant Field Values

CONTEXT_SCRIPT_MANAGER

static final java.lang.String CONTEXT_SCRIPT_MANAGER
Key to a repository object - script handler.

See Also:
Constant Field Values

CONTEXT_CLI_VARIABLE_MAP

static final java.lang.String CONTEXT_CLI_VARIABLE_MAP
Key to a repository object - script variables passed via CLI arguments.

See Also:
Constant Field Values

CONTEXT_OUTPUT_OBJECTS

static final java.lang.String CONTEXT_OUTPUT_OBJECTS
Key to a repository object - list with output objects, i.e. screenshots and warnings.

See Also:
Constant Field Values

CONTEXT_CURRENT_DOCUMENT_ELEMENT

static final java.lang.String CONTEXT_CURRENT_DOCUMENT_ELEMENT
Key to a repository object - currently executed document element.

See Also:
Constant Field Values

CONTEXT_LAST_EXECUTED_DOCUMENT_ELEMENT

static final java.lang.String CONTEXT_LAST_EXECUTED_DOCUMENT_ELEMENT
Key to a repository object - last executed document element.

See Also:
Constant Field Values

CONTEXT_RFB_EVENT_LIST

static final java.lang.String CONTEXT_RFB_EVENT_LIST
Key to a repository object - list with events received from the RFB server. It may contain just RfbServerEvent instances.

See Also:
Constant Field Values

CONTEXT_EXECUTION_START_DATE

static final java.lang.String CONTEXT_EXECUTION_START_DATE
Key to a repository object - execution start date & time.

See Also:
Constant Field Values

CONTEXT_CURRENT_SCRIPT_WRAPPER

static final java.lang.String CONTEXT_CURRENT_SCRIPT_WRAPPER
Key to a repository object - current script wrapper.

See Also:
Constant Field Values

CONTEXT_MASTER_SCRIPT_WRAPPER

static final java.lang.String CONTEXT_MASTER_SCRIPT_WRAPPER
Key to a repository object - master script wrapper.

See Also:
Constant Field Values

CONTEXT_PROCEDURE_MAP

static final java.lang.String CONTEXT_PROCEDURE_MAP
Key to a repository object - procedure table.

See Also:
Constant Field Values

CONTEXT_COMPILATION_FLAG

static final java.lang.String CONTEXT_COMPILATION_FLAG
Key to a repository object - a flag showing whether this is a validation repository or an execution one.

See Also:
Constant Field Values

CONTEXT_STOP_REASON

static final java.lang.String CONTEXT_STOP_REASON
Key to a repository object - a reason (String) describing why script execution was stopped. A mere presence of this object in the context should be interpreted as a request to stop execution and/or compilation.

See Also:
Constant Field Values

CONTEXT_PAUSE_REASON

static final java.lang.String CONTEXT_PAUSE_REASON
Key to a repository object - a reason (String) describing why script execution was paused.

See Also:
Constant Field Values

CONTEXT_COMPILATION_ERRORS

static final java.lang.String CONTEXT_COMPILATION_ERRORS
Key to a repository object - list of validation errors, i.e. errors in the script syntax.

See Also:
Constant Field Values

CONTEXT_LABEL_MAP

static final java.lang.String CONTEXT_LABEL_MAP
Key to a repository object - labels of the GoTo command

See Also:
Constant Field Values

CONTEXT_USER_CONFIGURATION

static final java.lang.String CONTEXT_USER_CONFIGURATION
Key to a repository object - user configuration

See Also:
Constant Field Values

CONTEXT_PROCEDURE_DECLARATION_FLAG

static final java.lang.String CONTEXT_PROCEDURE_DECLARATION_FLAG
Key to a repository object - a flag indicating whether we are in a procedure declaration or not

See Also:
Constant Field Values

CONTEXT_GOTO_TARGET_LABEL

static final java.lang.String CONTEXT_GOTO_TARGET_LABEL
Key to a repository object - labels of the GoTo command

See Also:
Constant Field Values

CONTEXT_SELECTED_DOCUMENT_ELEMENT

static final java.lang.String CONTEXT_SELECTED_DOCUMENT_ELEMENT
Key to a repository object - a flag indicating whether the current line of code can be executed or not

See Also:
Constant Field Values

CONTEXT_IMAGE_SEARCH_POINT_LIST

static final java.lang.String CONTEXT_IMAGE_SEARCH_POINT_LIST
Key to a repository object - a List of coordinates resulted from an image search

See Also:
Constant Field Values

CONTEXT_EXECUTION_DURATION

static final java.lang.String CONTEXT_EXECUTION_DURATION
Key to a repository object - duration of script execution.

See Also:
Constant Field Values

CONTEXT_EVENT_SOURCE

static final java.lang.String CONTEXT_EVENT_SOURCE
Key to a repository object - a Component instance which should be used as MouseEvent and KeyEvent source

See Also:
Constant Field Values

CONTEXT_INTERPRET

static final java.lang.String CONTEXT_INTERPRET
Key of a context object - test script interpret.

See Also:
Constant Field Values

CONTEXT_CONNECT_THROWABLE

static final java.lang.String CONTEXT_CONNECT_THROWABLE
Key of a context object - Throwable (exception) from a failed attempt to connect to a desktop.

See Also:
Constant Field Values

CONTEXT_TEMPLATE_META_DATA

static final java.lang.String CONTEXT_TEMPLATE_META_DATA
Key of a context object - last used template image meta data.

See Also:
Constant Field Values

CONTEXT_MASTER_INTERPRET

static final java.lang.String CONTEXT_MASTER_INTERPRET
Key of a context object - last used template image meta data.

See Also:
Constant Field Values

CONTEXT_TIMER_MANAGER

static final java.lang.String CONTEXT_TIMER_MANAGER
Key of a context object - timer manager (since 2.3).

See Also:
Constant Field Values

CONTEXT_DO_NOT_DESTROY_FLAG

static final java.lang.String CONTEXT_DO_NOT_DESTROY_FLAG
Key of a context object - a flag blocking destroying of the context (since 2.3).

See Also:
Constant Field Values

CONTEXT_DEBUG_MODE_FLAG

static final java.lang.String CONTEXT_DEBUG_MODE_FLAG
Key to a repository object - debug flag. If this object is present in the repository, script execution/validation debugging mechanisms are activated. Save for debugging this mode is also used by the Java script converter.

See Also:
Constant Field Values

CONTEXT_COMMENT_LIST

static final java.lang.String CONTEXT_COMMENT_LIST
Key of a context object - list of collected comments (since 2.3.1).

See Also:
Constant Field Values

CONTEXT_CODE_LINE_COUNTER

static final java.lang.String CONTEXT_CODE_LINE_COUNTER
Key of a context object - a counter showing number of compiled/executed code lines.

See Also:
Constant Field Values

CONTEXT_LAST_GENERATED_CLIENT_EVENT

static final java.lang.String CONTEXT_LAST_GENERATED_CLIENT_EVENT
Key of a context object - last script generated client event such as MouseEvent or KeyEvent (since 2.3).

See Also:
Constant Field Values

CONTEXT_EXECUTION_ERROR

static final java.lang.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)

See Also:
Constant Field Values

CONTEXT_EXECUTION_LOG

static final java.lang.String CONTEXT_EXECUTION_LOG
Key of a context object holding the script status data.

See Also:
Constant Field Values

CONTEXT_OCR_LAST_TEXT

static final java.lang.String CONTEXT_OCR_LAST_TEXT
Key of a context object containing the last recognized text by an OCR method or similar..

See Also:
Constant Field Values

CONTEXT_OCR_LAST_TEXT_RECT

static final java.lang.String CONTEXT_OCR_LAST_TEXT_RECT
Key of a context object containing rectangle of the last text recognized by an OCR method or similar..

See Also:
Constant Field Values

CONTEXT_OCR_LAST_TEXT_MAP

static final java.lang.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.

See Also:
Constant Field Values

CONTEXT_SUPPRESS_CLI_OUTPUT_FLAG

static final java.lang.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).

Since:
3.4
See Also:
Constant Field Values

CONTEXT_PARTIAL_EXECUTION_END_REACHED

static final java.lang.String CONTEXT_PARTIAL_EXECUTION_END_REACHED
Key of a context flag indicating that end of a selection execution has been reached.

Since:
3.4.1
See Also:
Constant Field Values

CONTEXT_PROJECT_BEAN

static final java.lang.String CONTEXT_PROJECT_BEAN
Key to the project bean (ProjectBean instance). See the getProject() method.

See Also:
Constant Field Values

CONTEXT_REPORT_ELEMENT

static final java.lang.String CONTEXT_REPORT_ELEMENT
See Also:
Constant Field Values

CONTEXT_REPORT_ELEMENT_LIST

static final java.lang.String CONTEXT_REPORT_ELEMENT_LIST
See Also:
Constant Field Values

CONTEXT_TEMPLATE_PATH_ELEMENT

static final java.lang.String CONTEXT_TEMPLATE_PATH_ELEMENT
See Also:
Constant Field Values

CONTEXT_OUTPUT_PATH_ELEMENT

static final java.lang.String CONTEXT_OUTPUT_PATH_ELEMENT
See Also:
Constant Field Values

IMPLICIT_VARIABLE_FILE_NAME

static final java.lang.String IMPLICIT_VARIABLE_FILE_NAME
See Also:
Constant Field Values

IMPLICIT_VARIABLE_FILE_NAME_SHORT

static final java.lang.String IMPLICIT_VARIABLE_FILE_NAME_SHORT
See Also:
Constant Field Values

IMPLICIT_VARIABLE_TIMESTAMP

static final java.lang.String IMPLICIT_VARIABLE_TIMESTAMP
See Also:
Constant Field Values

IMPLICIT_VARIABLE_DATESTAMP

static final java.lang.String IMPLICIT_VARIABLE_DATESTAMP
See Also:
Constant Field Values

IMPLICIT_VARIABLE_MACHINE_NAME

static final java.lang.String IMPLICIT_VARIABLE_MACHINE_NAME
See Also:
Constant Field Values

IMPLICIT_VARIABLE_PORT

static final java.lang.String IMPLICIT_VARIABLE_PORT
See Also:
Constant Field Values

IMPLICIT_VARIABLE_PROTOCOL

static final java.lang.String IMPLICIT_VARIABLE_PROTOCOL
See Also:
Constant Field Values

IMPLICIT_VARIABLE_URL

static final java.lang.String IMPLICIT_VARIABLE_URL
See Also:
Constant Field Values

IMPLICIT_VARIABLE_DISPLAY

static final java.lang.String IMPLICIT_VARIABLE_DISPLAY
See Also:
Constant Field Values

IMPLICIT_VARIABLE_REPORT_DIR

static final java.lang.String IMPLICIT_VARIABLE_REPORT_DIR
See Also:
Constant Field Values

IMPLICIT_VARIABLE_TEMPLATE_DIR

static final java.lang.String IMPLICIT_VARIABLE_TEMPLATE_DIR
See Also:
Constant Field Values

IMPLICIT_VARIABLE_SCRIPT_DIR

static final java.lang.String IMPLICIT_VARIABLE_SCRIPT_DIR
See Also:
Constant Field Values

IMPLICIT_VARIABLE_EXIT_CODE

static final java.lang.String IMPLICIT_VARIABLE_EXIT_CODE
See Also:
Constant Field Values

IMPLICIT_VARIABLE_DESKTOP_WIDTH

static final java.lang.String IMPLICIT_VARIABLE_DESKTOP_WIDTH
See Also:
Constant Field Values

IMPLICIT_VARIABLE_DESKTOP_HEIGHT

static final java.lang.String IMPLICIT_VARIABLE_DESKTOP_HEIGHT
See Also:
Constant Field Values

IMPLICIT_VARIABLE_WARNING_COUNT

static final java.lang.String IMPLICIT_VARIABLE_WARNING_COUNT
See Also:
Constant Field Values

IMPLICIT_VARIABLE_SERVER_CLIPBOARD_CONTENT

static final java.lang.String IMPLICIT_VARIABLE_SERVER_CLIPBOARD_CONTENT
See Also:
Constant Field Values

IMPLICIT_VARIABLE_CURTIME

static final java.lang.String IMPLICIT_VARIABLE_CURTIME
See Also:
Constant Field Values

IMPLICIT_VARIABLE_CURDATE

static final java.lang.String IMPLICIT_VARIABLE_CURDATE
See Also:
Constant Field Values

IMPLICIT_VARIABLE_CURDATE_FORMAT

static final java.lang.String IMPLICIT_VARIABLE_CURDATE_FORMAT
See Also:
Constant Field Values

IMPLICIT_VARIABLE_MOUSE_X

static final java.lang.String IMPLICIT_VARIABLE_MOUSE_X
See Also:
Constant Field Values

IMPLICIT_VARIABLE_MOUSE_Y

static final java.lang.String IMPLICIT_VARIABLE_MOUSE_Y
See Also:
Constant Field Values

IMPLICIT_VARIABLE_RANDOM

static final java.lang.String IMPLICIT_VARIABLE_RANDOM
See Also:
Constant Field Values

IMPLICIT_VARIABLE_RANDOM_MIN

static final java.lang.String IMPLICIT_VARIABLE_RANDOM_MIN
See Also:
Constant Field Values

IMPLICIT_VARIABLE_RANDOM_MAX

static final java.lang.String IMPLICIT_VARIABLE_RANDOM_MAX
See Also:
Constant Field Values

IMPLICIT_VARIABLE_RGB

static final java.lang.String IMPLICIT_VARIABLE_RGB
See Also:
Constant Field Values

IMPLICIT_VARIABLE_RGB_X

static final java.lang.String IMPLICIT_VARIABLE_RGB_X
See Also:
Constant Field Values

IMPLICIT_VARIABLE_RGB_Y

static final java.lang.String IMPLICIT_VARIABLE_RGB_Y
See Also:
Constant Field Values

IMPLICIT_VARIABLE_PROCEDURE_ARGUMENT_COUNT

static final java.lang.String IMPLICIT_VARIABLE_PROCEDURE_ARGUMENT_COUNT
See Also:
Constant Field Values

IMPLICIT_VARIABLE_PRODUCT_VERSION_SHORT

static final java.lang.String IMPLICIT_VARIABLE_PRODUCT_VERSION_SHORT
See Also:
Constant Field Values

IMPLICIT_VARIABLE_PRODUCT_VERSION_LONG

static final java.lang.String IMPLICIT_VARIABLE_PRODUCT_VERSION_LONG
See Also:
Constant Field Values

IMPLICIT_VARIABLE_PRODUCT_NAME

static final java.lang.String IMPLICIT_VARIABLE_PRODUCT_NAME
See Also:
Constant Field Values

IMPLICIT_VARIABLE_PRODUCT_HOME_PAGE

static final java.lang.String IMPLICIT_VARIABLE_PRODUCT_HOME_PAGE
See Also:
Constant Field Values

IMPLICIT_VARIABLE_PRODUCT_INSTALL_DIR

static final java.lang.String IMPLICIT_VARIABLE_PRODUCT_INSTALL_DIR
See Also:
Constant Field Values

IMPLICIT_VARIABLE_EXECUTION_SPEED_FACTOR

static final java.lang.String IMPLICIT_VARIABLE_EXECUTION_SPEED_FACTOR
See Also:
Constant Field Values

IMPLICIT_VARIABLE_FILE_SEPARATOR

static final java.lang.String IMPLICIT_VARIABLE_FILE_SEPARATOR
The file separator variable name (since 3.4.2).

See Also:
Constant Field Values

IMPLICIT_VARIABLE_FILE_PATH_SEPARATOR

static final java.lang.String IMPLICIT_VARIABLE_FILE_PATH_SEPARATOR
The file path separator variable name (since 3.4.2).

See Also:
Constant Field Values

IMPLICIT_VARIABLE_THREAD_ID

static final java.lang.String IMPLICIT_VARIABLE_THREAD_ID
The executing script thread name (since 3.5).

See Also:
Constant Field Values

WAITUNTIL_X

static final java.lang.String WAITUNTIL_X
See Also:
Constant Field Values

WAITUNTIL_Y

static final java.lang.String WAITUNTIL_Y
See Also:
Constant Field Values

WAITUNTIL_W

static final java.lang.String WAITUNTIL_W
See Also:
Constant Field Values

WAITUNTIL_H

static final java.lang.String WAITUNTIL_H
See Also:
Constant Field Values

WAITUNTIL_TIMEOUT

static final java.lang.String WAITUNTIL_TIMEOUT
See Also:
Constant Field Values

REPORT_REPORT_FILE

static final java.lang.String REPORT_REPORT_FILE
See Also:
Constant Field Values

REPORT_REPORT_FILENAME

static final java.lang.String REPORT_REPORT_FILENAME
See Also:
Constant Field Values

REPORT_REPORT_DESC

static final java.lang.String REPORT_REPORT_DESC
See Also:
Constant Field Values

REPORT_STATUS_IMAGE_NAME

static final java.lang.String REPORT_STATUS_IMAGE_NAME
See Also:
Constant Field Values

COMPARETO_RESULT

static final java.lang.String COMPARETO_RESULT
See Also:
Constant Field Values

COMPARETO_PASS_RATE

static final java.lang.String COMPARETO_PASS_RATE
See Also:
Constant Field Values

COMPARETO_TEMPLATE

static final java.lang.String COMPARETO_TEMPLATE
See Also:
Constant Field Values

COMPARETO_TIME_IN_MS

static final java.lang.String COMPARETO_TIME_IN_MS
See Also:
Constant Field Values

COMPARETO_TEMPLATE_INDEX

static final java.lang.String COMPARETO_TEMPLATE_INDEX
See Also:
Constant Field Values

COMPARETO_TEMPLATE_WIDTH

static final java.lang.String COMPARETO_TEMPLATE_WIDTH
See Also:
Constant Field Values

COMPARETO_TEMPLATE_HEIGHT

static final java.lang.String COMPARETO_TEMPLATE_HEIGHT
See Also:
Constant Field Values

COMPARETO_SOURCE_X

static final java.lang.String COMPARETO_SOURCE_X
See Also:
Constant Field Values

COMPARETO_SOURCE_Y

static final java.lang.String COMPARETO_SOURCE_Y
See Also:
Constant Field Values

COMPARETO_CLICK_X

static final java.lang.String COMPARETO_CLICK_X
See Also:
Constant Field Values

COMPARETO_CLICK_Y

static final java.lang.String COMPARETO_CLICK_Y
See Also:
Constant Field Values

COMPARETO_SORT_MODE

static final java.lang.String COMPARETO_SORT_MODE
See Also:
Constant Field Values

IMPLICIT_VARIABLE_INSTALL_DIR

static final java.lang.String IMPLICIT_VARIABLE_INSTALL_DIR
See Also:
Constant Field Values
Method Detail

getClient

RemoteDesktopClient getClient()
Get remote desktop client used for automation. It may be e.g. an RFB or RDP client.

Returns:
remote desktop client.

getConfiguration

UserConfiguration getConfiguration()
Get user configuration (preferences). It is typically a set of various parameters which affect behavior of the program. Configuration is usually loaded from a text or XML file or from a database.

Returns:
user configuration.

getScriptManager

ScriptManager getScriptManager()
Get script handler associated with this context. It is an object which handles execution of scripting language commands and structured blocks.

Returns:
script handler.

getScriptParams

java.util.Map getScriptParams()
Get the map of script parameters. They are passed to the program usually through the command line. Typical script parameters are remote host name and port to connect to, password for authentication and name of the script file to be executed. See the CLI Options documentation for complete reference of supported CLI options.

Returns:
script parameters.

setVariable

void setVariable(java.lang.String variableName,
                 java.lang.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.

Parameters:
variableName - a variable name (case sensitive).
value - variable value, usually a String (created through Var) or a Number (typically defined by Eval) instance.

getVariable

java.lang.Object getVariable(java.lang.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.

Parameters:
variableName - a case sensitive variable name to retrieve the value of.
Returns:
value of the specified variable, usually a String (created through Var) or a Number (typically defined by Eval) instance. The method returns null if the variable doesn't exist.

getVariableAsInt

java.lang.Integer getVariableAsInt(java.lang.String variableName)
Convenience method to get a context variable as Integer number. The method loads value of the named variable (see getVariable(java.lang.String)) and converts it to integer using the methods of the shared parser (see getParser()).

Parameters:
variableName - variable name (case sensitive).
Returns:
if the value is a proper number, the method returns a new Integer. If the value is not a number, the method throws a IllegalArgumentException. If the variable doesn't exist, the method returns null.

getVariableAsFloat

java.lang.Float getVariableAsFloat(java.lang.String variableName)
Convenience method to get a context variable as Float number. The method loads value of the named variable (see getVariable(java.lang.String)) and converts it to float using the methods of the shared parser (see getParser()).

Parameters:
variableName - variable name (case sensitive).
Returns:
if the value is a proper number, the method returns a new Float. If the value is not a number, the method throws an IllegalArgumentException. If the variable doesn't exist, the method returns null.

getVariableAsBoolean

java.lang.Boolean getVariableAsBoolean(java.lang.String variableName)
Convenience method to get a context variable as Boolean. The method loads value of the named variable (see getVariable(java.lang.String)) and converts it to boolean using the methods of the shared parser (see getParser()).

Parameters:
variableName - variable name (case sensitive).
Returns:
if the value is a proper boolean, the method returns a new Boolean. If the value is not a boolean, the method throws a IllegalArgumentException. If the variable doesn't exist, the method returns null.

getVariableAsString

java.lang.String getVariableAsString(java.lang.String variableName)
Convenience method to get a context variable as String. The method loads value of the named variable (see getVariable(java.lang.String)) and converts it to string using the Object.toString() method..

Parameters:
variableName - variable name (case sensitive).
Returns:
if the value exists, the method returns it as a String. Otherwise the method returns null.

getVariableAsPoint

java.awt.Point getVariableAsPoint(java.lang.String variableName)
Convenience method to get a context variable as Point. The method loads value of the named variable (see 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".

Parameters:
variableName - variable name (case sensitive).
Returns:
if the value is a valid point expression, the method returns a new Point. If the value is not a point expression, the method throws a IllegalArgumentException. If the variable doesn't exist, the method returns null.

getVariableAsRectangle

java.awt.Rectangle getVariableAsRectangle(java.lang.String variableName)
Convenience method to get a context variable as Rectangle. The method loads value of the named variable (see 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".

Parameters:
variableName - variable name (case sensitive).
Returns:
if the value is a valid rectangle expression, the method returns a new Rectangle. If the value is not a rectangle expression, the method throws a IllegalArgumentException. If the variable doesn't exist, the method returns null.

getVariableAsColor

java.awt.Color getVariableAsColor(java.lang.String variableName)
Convenience method to get a context variable as Color. The method loads value of the named variable (see 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".

Parameters:
variableName - variable name (case sensitive).
Returns:
if the value is a valid color expression, the method returns a new Color. If the value is not a color expression, the method throws a IllegalArgumentException. If the variable doesn't exist, the method returns null.

getVariables

ListenerMap<java.lang.String,java.lang.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.

Returns:
variable map. If the map doesn't exist, the method creates a new one and inserts it into the context map. It never returns null.

equals

boolean equals(java.lang.Object variable1,
               java.lang.Object variable2)
This method is provided to ensure compatibility of boolean expressions converted from the scripting language. It compares two values and returns 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.

Parameters:
variable1 - first variable value.
variable2 - another variable value.
Returns:
true if the values equal in terms of the scripting language specification.

getExitCode

int getExitCode()
Get exit code of the last executed command.

Returns:
exit code of the last executed command.

getOutputDir

java.io.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.

Returns:
path to save test script execution output objects to.

setOutputDir

void setOutputDir(java.io.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.

Parameters:
directory - a new output path or null to reset the directory to the default value.

getTemplateDir

java.io.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.

Returns:
directory to read template images from.

setTemplateDir

void setTemplateDir(java.io.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.

Parameters:
directory - a new path to read template images from.

getServerClipboardContent

java.lang.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.

Returns:
desktop server clipboard content or null if either the clipboard is empty or the protocol used doesn't support clipboard transfers.

getSearchHits

java.util.List<java.awt.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:

Returns:
list of coordinates representing match locations found by the last executed image search. If no image search has been performed yet the method returns null. If the image search result was negative and no matches were produced, the method returns an empty list.

getSearchRects

java.util.List<java.awt.Rectangle> getSearchRects()
Get the list of rectangular areas matched by the image search algorithm. The method returns a list of the same size as the one returned by the 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.

Returns:
list of rectangular bounding areas of objects located through the Image Search method.
Since:
2.3.2

getSearchHitTemplateIndex

int getSearchHitTemplateIndex()
Get index of the matching template image from the last image search. See the getSearchHits() method documentation for more.

Returns:
index of matching template image or -1 if no image search has been performed or no matches were found.

getSearchHitTemplateSize

java.awt.Dimension getSearchHitTemplateSize()
Get size of the matching template image from the last image search. It can be used together with the list of match points to construct matching areas (rectangles) on the connected desktop image. See the getSearchHits() method documentation for more.

Returns:
size of matching template image or null if no image search has been performed or no matches were found.

getSearchHitClickPoint

java.awt.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.

Returns:
the source point or null if it is not defined. If no image search has been performed yet the method returns null or if the image search result was negative and no matches were produced, the method returns null.

getSearchHitClickPoint

java.awt.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.

Returns:
the source point or null if it is not defined. If no image search has been performed yet the method returns null or if the image search result was negative and no matches were produced, the method returns null.

getSearchHitSourcePoint

java.awt.Point getSearchHitSourcePoint()
Get the source point of the matching template image from the last image search. It is the location in the screen the template image was originally cropped from. It may be used for testing of whether the component has moved.

Returns:
the source point or null if it is not defined. If no image search has been performed yet the method returns null or if the image search result was negative and no matches were produced, the method returns null.

getSearchHitTemplateFile

java.io.File getSearchHitTemplateFile()
Get file of the matching template image in the last image search. The method will return null after successful search which was started through Java API with Image instances.

Returns:
matching template image file or null if no image search has been performed or no matches were found or the search performed with Image instances (such as through the DefaultJavaTestScript.compareTo(java.awt.Image[], com.tplan.robot.imagecomparison.ImageComparisonModule, float, java.awt.Rectangle) method).

getSearchHitTemplateMetaData

TemplateImageBean getSearchHitTemplateMetaData()
Get meta data container of the matching template image in the last image search. See the getSearchHits() method documentation for more.

Returns:
template image meta data container or null if no image search has been performed or no matches were found or the search performed with Image instances (such as through the DefaultJavaTestScript.compareTo(java.awt.Image[], com.tplan.robot.imagecomparison.ImageComparisonModule, float, java.awt.Rectangle) method).

getComparisonResult

java.lang.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.

Returns:
a number between 0 and 100 representing image comparison result as a percentage expressing how much the two compared images match.

getObjectSearchShapes

java.util.List<java.awt.Shape> getObjectSearchShapes()
Get the list of shapes located through the Object Search image comparison method. To get the bounding rectangle of an individual rectangle call the Shape.getBounds() method.

Returns:
list of shapes produced by the Object Search.

getObjectSearchRects

java.util.List<java.awt.Rectangle> getObjectSearchRects()
Get the list of rectangles located through the Object Search image comparison method. The method returns a list of the same size as the one returned by the getObjectSearchShapes() method where each Shape is converted to a rectangle using Shape.getBounds().

Returns:
list of rectangular bounding areas of objects located through the Object Search method.
Since:
2.3.2

getObjectSearchHit

java.awt.Point getObjectSearchHit(int index)
Get the top left corner from the object search match of the specified index. The method throws ArrayIndexOutOfBoundsException if the index is >= the number of matches.

Parameters:
index - index (the first match has the index of 0).
Returns:
top left corner location of the specified match shape (rectangle).

getParser

TokenParser getParser()
Get an instance of the text parser. It is an object providing methods able to parse command names, parameters and their values, and convert textual representation of particular objects/values (for example, rectangles) to/from Java object instances.

Returns:
scripting language parser.

getEventSource

java.awt.Component getEventSource()
Get a dummy event source. As Java events require a 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.

Returns:
component which may be used as AWT event source.

getMasterWrapper

TestWrapper getMasterWrapper()
Get the master test wrapper. It is a top level envelope around a compiled or executed test script and maintains basic information about the test script source and owner.

Returns:
top level master wrapper which is usually either a ScriptWrapper instance (when the test script is a proprietary one) or DefaultJavaTestScript when the test script is a Java one.

getCommandLineVariables

java.util.Map<java.lang.String,java.lang.String> getCommandLineVariables()
Get the map of override variables. They are typically defined through the -v/--variable command line parameters. They override values of variables specified in scripts. See the CLI Options documentation on how to override script variables.

Returns:
command line variable map.

getInterpret

TestScriptInterpret getInterpret()
Get the test script interpret associated with this context.

Returns:
test script interpret.

getMasterInterpret

TestScriptInterpret getMasterInterpret()
Get the master test script interpret (the top level one) associated with this context.

Returns:
master test script interpret.

getCompilationErrors

java.util.List<SyntaxErrorException> getCompilationErrors()
Get the list of compilation errors in form of SyntaxErrorException instances.

Returns:
list of compilation errors.

getOutputObjects

java.util.List<OutputObject> getOutputObjects()
Get the list of output objects.

Returns:
list of output objects such as screenshots, warnings and logs.

getConnectError

java.lang.Throwable getConnectError()
Get the most recent throwable resulting from an attempt to connect to a desktop. If a Connect command gets executed, it saves any eventual connection error to the context.

Returns:
connection error (exception).

isCompilationContext

boolean isCompilationContext()
Indicate whether this context as a compilation one or execution one.

Returns:
true if it is a compilation context, false if it's and execution one. Default value is true.

dispose

void dispose()
Dispose (destroy) this context. The method should clear up all references which may be difficult for the garbage collector to reclaim, for example variable map listeners. The context should not be used any more after this method gets called.


getTimerValue

java.lang.Long getTimerValue(java.lang.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).

Parameters:
timerName - timer name (case sensitive).
Returns:
timer value in milliseconds or null if timer of the specified name doesn't exist.

isTimerRunning

java.lang.Boolean isTimerRunning(java.lang.String timerName)
Find out whether a timer exists and is running (measuring time). 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. Otherwise the method returns a valid Boolean value indicating whether the timer is started or not.

Parameters:
timerName - timer name (case sensitive).
Returns:
Boolean.true if the timer exists and is running, Boolean.false if the timer exists and is not running (is was either stopped or it has never been started) or null if timer of the specified name doesn't exist.

recordComment

boolean recordComment(javax.swing.text.Element comment)
Record a comment to the comment collection facility if it is supported and enabled.

Parameters:
comment - a comment.
Since:
2.3.1

getExecutionLog

ScriptLogger getExecutionLog()
Get the execution log. It is an object which maintains the location of the currently executed command (stack trace) and the entry and exit points of execution (where/when the script started and where it finished and why). The object also records all runtime syntax errors thrown by the script. It also enables third party scripts to record a log.

Returns:
execution log object.
Since:
3.0

getRGB

java.awt.Color getRGB(int x,
                      int y)
Get the RGB color at the specified coordinates of the connected desktop. If there is no connection the method returns null. The method throws an ArrayIndexOutOfBoundsException if the coordinates are out of bounds.

Parameters:
x - the X-coordinate within [0, desktopWidth-1].
y - the Y-coordinate within [0, desktopHeight-1].
Returns:
the color at the specified coordinates.
Since:
3.0

getRGBAsString

java.lang.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"). If there is no connection the method returns null. The method throws an ArrayIndexOutOfBoundsException if the coordinates are out of bounds.

Parameters:
x - the X-coordinate within [0, desktopWidth-1].
y - the Y-coordinate within [0, desktopHeight-1].
Returns:
the color in HTML format at the specified coordinates.
Since:
3.0

addObjectListener

void addObjectListener(java.lang.String key,
                       java.beans.PropertyChangeListener l)

removeObjectListener

void removeObjectListener(java.beans.PropertyChangeListener l)

getRecognizedText

java.lang.String getRecognizedText(java.awt.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.

Parameters:
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.
Returns:
the last text recognized from the screen.

getRecognizedTextElements

java.util.LinkedHashMap<java.lang.String,java.awt.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. As the current implementation of the Tesseract OCR doesn't support text coordinates this method returns only results of the Image Based Text Recognition.

Returns:
the map of text elements and their locations. The elements are sorted in the reading order, from the left to the right, from the top to the bottom. The method may return null if no OCR-like recognition has been performed.

getRecognizedTextClickPoint

java.awt.Point getRecognizedTextClickPoint()
Get the center of the string located by the OCR. This presumes that the OCR has been performed with the "text" parameter to search the recognized text for a particular string. This feature is typically used for actions like "find the specified text on the screen or its part and click it". To obtain the bounding rectangle of the whole recognized text use the getRecognizedText(java.awt.Rectangle) method.

Returns:
the click point (center of the located string rectangle). The method returns null if the string was not located or the OCR was not performed.
Since:
3.3.1

getProject

com.tplan.robot.scripting.project.ProjectBean getProject()
Get the currently opened project.

Returns:
the current project.

getSeqNo

int getSeqNo()
Get the unique context's sequence number. It is useful for tracking.

Returns:
the unique context's sequence number.
Since:
4.0

T-Plan Robot Enterprise 4.0
Build No. 4.0-20140924.1