This page is maintained for older versions of Rapise only. The latest documentation can be found at: https://rapisedoc.inflectra.com
Global

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.

DoInvokeTest

Invokes another test script (as sub-test).

DoKillByName

Terminates a given process.

DoKillByPid

Terminates a given process.

DoLaunch

Executes a command specified in cmdLine.

DoLoadObjects

Load objects from external .objects.js file.

DoMessageBox

Shows message box (popup message) to a user.

DoMouseMove

Moves mouse to the specified position.

DoPlayManual

Executes manual test.

DoRunTestSet

Executes 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.

DoWaitFor

Waits for object specified by id to be 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 current directory of the test.

GetOsOwner

Reads OS registered owner from the registry.

GetOsPath

Reads OS root path from the registry.

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

Retrieves the system special folder path.

SetFileAsByteArray

Creates or rewrites file and fills with contents of 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


 

 

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".

 

DoInvokeTest(pathToTest, optionalParams)

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

 

Parameters:

 

Name

Type

Description

pathToTest

String

Absolute or relative path to a subtest

optionalParams

Object

Optional params

 

Returns:

 

'true' if test passed.

 

DoKillByName(processName)

Terminates a given process.

 

Parameters:

 

Name

Type

Description

processName

String

Name of the process.

 

Returns:

 

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

 

DoKillByPid(pid)

Terminates a given process.

 

Parameters:

 

Name

Type

Description

pid

Number

ID of the process.

 

Returns:

 

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

 

DoLaunch(cmdLine, wrkDir, attachIfExists, attachToWindow)

Executes a command specified in cmdLine.

 

Parameters:

 

Name

Type

Description

cmdLine

String

Command line to execute.

wrkDir

String

Working directory for the new process.
Optional.

attachIfExists

Boolean

Try to find existing process before starting new one. If no process found then new one is created.
Optional.

attachToWindow

String

when attachIfExists is true this parameter may be used to specify top window name to find a process to attach to.
Optional.

 

Returns:

 

ID of the new process.

 

DoLoadObjects()

Load objects from external .objects.js file.

 

Parameters:

 

Name

Type

Description

objectsFilePath.

String

 

 

DoMessageBox(prompt, buttons)

Shows message box (popup message) to a user.

 

Parameters:

 

Name

Type

Description

prompt

String

Message to display

buttons

Number

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
Optional, Default: 0.

 

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.

 

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 manual test. Results are shown in the report of the caller test.

 

Parameters:

 

Name

Type

Description

rmtFilePath

String

Path to manual test (.rmt) file.

rmtParams

Object

 

 

DoRunTestSet(testSetFilePath, testSetParams)

Executes test set. Results are shown in the report of the caller test.

 

Parameters:

 

Name

Type

Description

testSetFilePath

String

Path to test set file.

testSetParams

Object

 

 

DoSendKeys(keys)

Sends series of keystrokes to a currently focused application.

 

Parameters:

 

Name

Type

Description

keys

String

A sequence of keystrokes.

 

See:

MSDN Article for SendKeys

 

DoSleep(millis)

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

 

Parameters:

 

Name

Type

Description

millis

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

 

 

Returns:

 

Trimmed string.

 

DoWaitFor(objectId, timeout)

Waits for object specified by id to be available. Function returns if object was found or timeout.

 

Parameters:

 

Name

Type

Description

objectId

String

ID of object to wait for.

timeout

Number

Maximum time to wait.
Optional, Default: 10000.

 

Returns:

 

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 case of timeout.

 

Parameters:

 

Name

Type

Description

obj

String |
SeSObject

ID of object to wait for or object itself.

getterName

String

Property getter function name.

propValue

String |
Number |
Boolean

Desired value.

timeout

Number

Maximum time to wait.
Optional, Default: 10000.

params

Array |
String |
Number |
Boolean

Parameters for property getter function.
Optional.

 

Returns:

 

Found object or 'false'.

 

GetCurrentDir()

Gets current directory path.

 

Returns:

 

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

Name of a file.

 

Returns:

 

array of bytes.

 

GetFirstDayOfWeek()

Returns first day of week for current user

 

Returns:

 

0 - Sunday, 1 - Monday.

 

GetFullPath(fileName)

Constructs an absolute file name using current directory of the test.

 

Parameters:

 

Name

Type

Description

fileName

String

Name of a file.

 

Returns:

 

Absolute file name.

 

GetOsOwner()

Reads OS registered owner from the registry.

 

Returns:

 

OS registered owner.

 

GetOsPath()

Reads OS root path from the registry.

 

Returns:

 

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

 

GetOsType()

Reads OS type from the registry.

 

Returns:

 

OS type.

 

GetOsVersion()

Reads OS service pack version from the registry.

 

Returns:

 

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:

 

Propery value. If a property does not exist then defValue is returned. If defValue is not set then null is returned.

 

GetSpecialFolderPath(folder)

Retrieves the system special folder path.

 

Parameters:

 

Name

Type

Description

folder

String

The system special folder name as defined in .NET Environment.SpecialFolder enum, e.g. "ProgramFiles".
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.

 

Returns:

 

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 provided byte array

 

Parameters:

 

Name

Type

Description

fileName

String

Name of a file.

bytes

Array

array of bytes to write

 

Returns:

 

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:

 

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