Global

Top  Previous  Next

 

Global object. Use it to perform actions not related to a particular object. You do not need to record or learn this object, it is always automatically available in any test.

 

 

Action Summary

 

Action

Description

DoAnalogPlay

Performs Analog Playback of events recorded in a file.

DoAppActivate

Activates window with the specified title.

DoClick

Performs mouse click at the current position.

DoCompareJsObjects

Compares two JavaScript objects and prints differences to the report.

DoDecrypt

Decrypts a piece of text.

DoEncrypt

Encrypts a piece of text.

DoInvokeTest

Invokes another test (aka subtest).

DoKillByName

Terminates a given process.

DoKillByPid

Terminates a given process or the last process created by DoLaunch if 'pid' is not specified.

DoLaunch

Executes a command specified in cmdLine.

DoLoadObjects

Loads objects from external .objects.js file.

DoMessageBox

Shows message box (popup message) to a user.

DoMouseMove

Moves mouse to the specified position.

DoPlayManual

Executes a manual test.

DoRunTestSet

Executes a test set.

DoSendKeys

Sends series of keystrokes to a currently focused application.

DoSleep

Pauses execution for given number of milliseconds (1000 = 1 second).

DoTrim

Strips leading and trailing white-space from a string, replaces sequences of whitespace characters by a single space, and returns the resulting string.

DoTypePassword

Types encrypted password into a control which has a focus.

DoWaitFor

Waits for object specified by objectId to become available.

DoWaitForProperty

Waits for specified value of object's property.

GetCurrentDir

Gets current directory path.

GetFileAsByteArray

Reads file and returns its content as array of bytes.

GetFirstDayOfWeek

Returns first day of week for current user.

GetFullPath

Constructs an absolute file name using working directory (WORKDIR) of the test.

GetOsOwner

Reads OS registered owner from the registry.

GetOsPath

Returns OS root path.

GetOsType

Reads OS type from the registry.

GetOsVersion

Reads OS service pack version from the registry.

GetProperty

Reads property value from %WORKDIR%\Config.json.

GetSpecialFolderPath

Returns path to a special folder specified by one of possible values.

SetFileAsByteArray

Creates or rewrites file and fills with contents of the provided byte array.

SetProperty

Sets property value to %WORKDIR%\Config.json.

 

Action Detail

 

DoAnalogPlay(path, left, top)

Performs Analog Playback of events recorded in a file.

 

Parameters:

 

Name

Type

Description

path

String

This is a path to a file with recorded analog events.

left

Number

X-coordinate of top-left corner of the analog area.

top

Number

Y-coordinate of the top-left corner of the analog area.

 

DoAppActivate(title)

Activates window with the specified title. I.e. Global.DoAppActivate("Calculator") will bring running instance (if any) of Windows Calculator to the foreground.

 

Parameters:

 

Name

Type

Description

title

String

Title of an application window.

 

See:

MSDN Article for AppActivate

 

DoClick(clickType)

Performs mouse click at the current position.

 

Parameters:

 

Name

Type

Description

clickType

string

Type of click, can be one of "L" - left click, "LD" - double left click, "R" - right click, "RD" - double right click, "M" - middle click, "MD" - double middle click, "N" - don't click
Optional, Default: L.

 

DoCompareJsObjects(msg, obj1, obj2)

Compares two JavaScript objects and prints differences to the report.

 

Parameters:

 

Name

Type

Description

msg

String

Message to write into report.

obj1

Object

First object.

obj2

Object

Second object.

 

Returns:

 

Boolean: 'true' if two objects are equal, 'false' otherwise.

 

DoDecrypt(encryptedText)

Decrypts a piece of text.

 

Parameters:

 

Name

Type

Description

encryptedText

String

Text to decrypt.

 

Returns:

 

String: Decrypted text.

 

DoEncrypt(plainText)

Encrypts a piece of text.

 

Parameters:

 

Name

Type

Description

plainText

String

Text to encrypt.

 

Returns:

 

String: Encrypted text.

 

DoInvokeTest(pathToTest, optionalParams)

Invokes another test (aka subtest). The subtest should have the set of libraries as calling test. Otherwise it may lead to a conflict.

 

Parameters:

 

Name

Type

Description

pathToTest

String

Path to .sstest file.

optionalParams

Object

Parameters to pass into entry point Test() function of the subtest. I.e. it is called as Test(optionalParams).

 

Returns:

 

Boolean: 'true' if the test passed, 'false' otherwise.

 

DoKillByName(processName)

Terminates a given process.

 

Parameters:

 

Name

Type

Description

processName

String

Executable name to kill (such as 'iexplore.exe').

 

Returns:

 

Boolean: 'true' if the process was terminated, 'false' otherwise.

 

DoKillByPid(pid)

Terminates a given process or the last process created by DoLaunch if 'pid' is not specified.

 

Parameters:

 

Name

Type

Description

pid

Number

ID of the process.
Optional.

 

Returns:

 

Boolean: 'true' if the process was terminated, 'false' otherwise.

 

DoLaunch(cmdLine, wrkDir, attachIfExists, attachToWindow)

Executes a command specified in cmdLine. Optionally one may specify working dir, and window name to attach if it is already launched.

 

Parameters:

 

Name

Type

Description

cmdLine

String

Command line to an executable with parameters.

wrkDir

String

Working directory. By default it is a directory of the test.
Optional, Default: ..

attachIfExists

Boolean

Try to find a process with the same executable path instead of launching it.
Optional, Default: false.

attachToWindow

String

When attachIfExists is 'true' this parameter may be used to specify top window name to find a process to attach to.
Optional, Default: null.

 

Returns:

 

Number: ID of the new process.

 

DoLoadObjects(objectsFilePath)

Loads objects from external .objects.js file.

 

Parameters:

 

Name

Type

Description

objectsFilePath

string

Path to *.objects.js file.

 

Returns:

 

Object: saved_script_objects or null if the load was unsuccessful.

 

DoMessageBox(prompt, buttons)

Shows message box (popup message) to a user.


'buttons' is a value or a sum of values that specifies the number and type of buttons to display, the icon style to use, the identity of the default button, and the modality of the message box. Default value is 0.

	0 = vbOKOnly - OK button only
	1 = vbOKCancel - OK and Cancel buttons
	2 = vbAbortRetryIgnore - Abort, Retry, and Ignore buttons
	3 = vbYesNoCancel - Yes, No, and Cancel buttons
	4 = vbYesNo - Yes and No buttons
	5 = vbRetryCancel - Retry and Cancel buttons
	16 = vbCritical - Critical Message icon
	32 = vbQuestion - Warning Query icon
	48 = vbExclamation - Warning Message icon
	64 = vbInformation - Information Message icon
	0 = vbDefaultButton1 - First button is default
	256 = vbDefaultButton2 - Second button is default
	512 = vbDefaultButton3 - Third button is default
	768 = vbDefaultButton4 - Fourth button is default
	0 = vbApplicationModal - Application modal (the current application will not work until the user responds to the message box)
	4096 = vbSystemModal - System modal (all applications wont work until the user responds to the message box)
			    

We can divide the buttons values into four groups: The first group (0�5) describes the buttons to be displayed in the message box, the second group (16, 32, 48, 64) describes the icon style, the third group (0, 256, 512, 768) indicates which button is the default; and the fourth group (0, 4096) determines the modality of the message box. When adding numbers to create a final value for the buttons parameter, use only one number from each group.


The function returns a number representation of a button pressed by user:

vbOK1OK button was clicked.
vbCancel2Cancel button was clicked.
vbAbort3Abort button was clicked.
vbRetry4Retry button was clicked.
vbIgnore5Ignore button was clicked.
vbYes6Yes button was clicked.
vbNo7No button was clicked.

 

Parameters:

 

Name

Type

Description

prompt

String

Message to display.

buttons

number

Buttons to show.
Optional, Default: 0.

 

Returns:

 

Number: A number representation of a button pressed by user.

 

DoMouseMove(x, y)

Moves mouse to the specified position.

 

Parameters:

 

Name

Type

Description

x

Number

Absolute X-coordinate of the target mouse position.

y

Number

Absolute Y-coordinate of the target mouse position.

 

DoPlayManual(rmtFilePath, rmtParams)

Executes a manual test. Results are shown in the report of the calling test.

 

Parameters:

 

Name

Type

Description

rmtFilePath

string

Path to manual test (.rmt) file.

rmtParams

Object

Additional parameters to pass to the manual test executor.
Optional.

 

Returns:

 

Boolean: 'true' if the manual test passed, 'false' otherwise.

 

DoRunTestSet(testSetFilePath, testSetParams)

Executes a test set. Results are shown in the report of the calling test.

 

Parameters:

 

Name

Type

Description

testSetFilePath

string

Path to a test set file.

testSetParams

Object

Additional parameters to pass for each test in the test set.
Optional.

 

DoSendKeys(keys)

Sends series of keystrokes to a currently focused application.

 

Parameters:

 

Name

Type

Description

keys

String

Keystrokes as described in the MSDN Article for SendKeys.

 

See:

MSDN Article for SendKeys

 

DoSleep(millis=1000)

Pauses execution for given number of milliseconds (1000 = 1 second).

 

Parameters:

 

Name

Type

Description

millis=1000

Number

Number of milliseconds to sleep.

 

DoTrim(str, global, trimChars)

Strips leading and trailing white-space from a string, replaces sequences of whitespace characters by a single space, and returns the resulting string. Whitespace characters are [ \f\n\r\t\v\u00a0\u1680\u180e\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff].

 

Parameters:

 

Name

Type

Description

str

String

String to trim.

global

Boolean

If 'true' then global trim is performed (whitespaces in the middle are substituted with a single space). If 'false' only ends are trimmed.
Optional, Default: false.

trimChars

String

String with each char to be subject for trim.
Optional.

 

Returns:

 

String: Trimmed string.

 

DoTypePassword(encryptedPassword)

Types encrypted password into a control which has a focus.

 

Parameters:

 

Name

Type

Description

encryptedPassword

String

Password to type. Encrypted.

 

Returns:

 

String: 'true'

 

DoWaitFor(objectId, timeout)

Waits for object specified by objectId to become available. Function returns if object was found or timeout.

 

Parameters:

 

Name

Type

Description

objectId

String

Id of an object to wait for.

timeout

Number

Maximum time to wait (milliseconds).
Optional, Default: 10000.

 

Returns:

 

SeSObject |
Boolean: Found object or 'false'.

 

DoWaitForProperty(obj, getterName, propValue, timeout, params)

Waits for specified value of object's property. Function returns object handle if object was found and specified property equals to desired value or 'false' in the case of timeout.

 

Parameters:

 

Name

Type

Description

obj

String |
SeSObject

Id of an object to wait for or object itself.

getterName

String

Property getter function name.

propValue

String |
Number |
Boolean

Desired property value.

timeout

Number

Maximum time to wait (milliseconds).
Optional, Default: 10000.

params

Array |
String |
Number |
Boolean

Parameters for property getter function.
Optional.

 

Returns:

 

SeSObject |
Boolean: Found object or 'false'.

 

GetCurrentDir()

Gets current directory path.

 

Returns:

 

String: Path of the current directory.

 

GetFileAsByteArray(fileName)

Reads file and returns its content as array of bytes. May be useful for binary files and for passing data to web services.

 

Parameters:

 

Name

Type

Description

fileName

String

Filename to read (recommended to use absolute file name).

 

Returns:

 

Object: Array of bytes.

 

GetFirstDayOfWeek()

Returns first day of week for current user.

 

Returns:

 

Number: 0 - Sunday, 1 - Monday.

 

GetFullPath(fileName)

Constructs an absolute file name using working directory (WORKDIR) of the test.

 

Parameters:

 

Name

Type

Description

fileName

String

Name of a file.

 

Returns:

 

String: Absolute file name.

 

GetOsOwner()

Reads OS registered owner from the registry.

 

Returns:

 

String: OS registered owner.

 

GetOsPath()

Returns OS root path.

 

Returns:

 

String: OS root path without the trailing backslash, e.g. 'C:\Windows'.

 

GetOsType()

Reads OS type from the registry.

 

Returns:

 

String: OS type string.

 

GetOsVersion()

Reads OS service pack version from the registry.

 

Returns:

 

String: Service pack version.

 

GetProperty(name, defValue)

Reads property value from %WORKDIR%\Config.json.

 

Parameters:

 

Name

Type

Description

name

String

Name of a property

defValue

String |
Number |
Boolean

Default value to return if property does not exist
Optional.

 

Returns:

 

String |
Number |
Boolean: Propery value. If a property does not exist then defValue is returned. If defValue is not set then null is returned.

 

GetSpecialFolderPath(folder=MyDocuments)

Returns path to a special folder specified by one of possible values.
Possible values:
ApplicationDataThe directory that serves as a common repository for application-specific data for the current roaming user.
CommonApplicationDataThe directory that serves as a common repository for application-specific data that is used by all users.
CommonProgramFilesThe directory for components that are shared across applications.
CookiesThe directory that serves as a common repository for Internet cookies.
DesktopThe logical Desktop rather than the physical file system location.
DesktopDirectoryThe directory used to physically store file objects on the desktop.
FavoritesThe directory that serves as a common repository for the user's favorite items.
HistoryThe directory that serves as a common repository for Internet history items.
InternetCacheThe directory that serves as a common repository for temporary Internet files.
LocalApplicationDataThe directory that serves as a common repository for application-specific data that is used by the current, non-roaming user.
MyComputerThe "My Computer" folder.
MyDocumentsThe "My Documents" folder.
MyMusicThe "My Music" folder.
MyPicturesThe "My Pictures" folder.
PersonalThe directory that serves as a common repository for documents.
ProgramFilesThe program files directory.
ProgramsThe directory that contains the user's program groups.
RecentThe directory that contains the user's most recently used documents.
SendToThe directory that contains the Send To menu items.
StartMenuThe directory that contains the Start menu items.
StartupThe directory that corresponds to the user's Startup program group.
SystemThe System directory.
TemplatesThe directory that serves as a common repository for document templates.

 

Parameters:

 

Name

Type

Description

folder=MyDocuments

string

Folder Id.

 

Returns:

 

String: System specified folder path without the trailing backslash, e.g. 'C:\Program Files'.

 

SetFileAsByteArray(fileName, bytes)

Creates or rewrites file and fills with contents of the provided byte array.

 

Parameters:

 

Name

Type

Description

fileName

String

Filename to write (recommended to use absolute file name).

bytes

Array

Array of bytes to write.

 

Returns:

 

Number: Number of bytes written.

 

SetProperty(name, value)

Sets property value to %WORKDIR%\Config.json. If the file does not exist it will be created.

 

Parameters:

 

Name

Type

Description

name

String

Name of a property.

value

String |
Number |
Boolean

Value to set.

 

Returns:

 

Boolean: 'true' if property value set successfully, 'false' otherwise.