Basic Windows Operations
The folder TBox Automation Tools->Basic Windows Operations in the Standard subset contains the following Modules:
TBox Take Screenshot
This Module takes a screenshot of the currently active screen. After you've run your tests, you can view the screenshot in the Detail column of the ExecutionEntry.
The Module TBox Take Screenshot has the following ModuleAttributes:
ModuleAttribute |
Description |
---|---|
Defines whether you want to take a screenshot of your desktop, mobile device, or browser. If you leave the value empty, Tosca takes a screenshot of the desktop. |
|
Storage Location Type |
Optionally, specify whether you want to save your screenshot to If you don't specify a Storage Location Type, Tosca uses the storage path defined in the setting Screenshot directory. |
Directory |
Optionally, specify a local path to save the screenshot to. If you don't specify a Storage Location Type or Directory, Tosca uses the storage path defined in the setting Screenshot directory. |
Filename |
File name of the screenshot. This name doesn't include the file extension. You can define the file format in the setting Screenshot image format. |
Select Screen |
Optionally, specify which screen or application you want to capture. You can choose from the following options:
If you don't specify a value, Tricentis Tosca takes a screenshot of all connected screens. |
![]() |
In this example, you perform the following actions:
![]() Take a screenshot of the desktop with the Module TBox Take Screenshot |
TBox Clipboard
This Module allows you to copy a text to the Microsoft Windows clipboard. You can also use it to verify the text that's in your clipboard, save that text to a buffer, or wait until a certain text is in the clipboard.
It has the following ModuleAttribute:
ModuleAttribute |
Description |
---|---|
Value |
Value that you want to copy to the clipboard, verify, buffer, or wait on. Depending on the desired action, use ActionMode Input, Verify, Buffer, or WaitOn respectively. |
![]() |
This example shows how to work with TBox Clipboard.
TBox Clipboard |
TBox Dialog
The Module TBox Dialog steers dialog windows.
-
Microsoft Windows® dialogs: you can steer them without scanning them.
-
Customized dialogs: you need to scan them first.
The Module TBox Dialog has the following ModuleAttributes:
ModuleAttribute |
Description |
---|---|
Caption |
Caption of the dialog window that you want to steer. This caption identifies the dialog window. |
Label |
You can enter the text of the dialog window’s first paragraph for further identification. It's not necessary to enter the entire text. This ModuleAttribute is optional. |
Button |
Specify which button Tosca should click to confirm the dialog. Enter the text of the button. |
![]() |
This example shows how to steer the following dialog:
Dialog you want to steer The TestStep performs the following actions:
TBox Dialog example |
TBox Context Menu
The Module TBox Context Menu allows you to control context menus of applications based on .NET and WinForms
![]() |
To use the Module TBox Context Menu, the context menu that you want to steer has to be open so Tricentis Tosca can detect it. |
It has the following ModuleAttributes:
ModuleAttribute |
Description |
---|---|
Menu |
Path to the menu item. Specify the context menu path with ->, for instance Insert->Image. |
Menu-><MenuItem> |
Alternatively, you can use this ModuleAttribute to steer a context menu with control hierarchy instead (see example below). |
![]() |
In the example below, you perform the following actions:
Steer a context menu example |
![]() |
In this example, you select the entry Insert->New Image of a context menu which is currently open. It does so in two different ways:
Different ways to steer a WinForms context menu |
TBox Send Keys
This Module sends keyboard commands to a window. Like the SendKeys keyboard command, the Module TBox Send Keys uses the WinForms function SendKeys.
The Module TBox Send Keys has the following ModuleAttributes:
ModuleAttribute |
Description |
---|---|
Caption |
Optionally, enter the caption assigned to the window you want to steer. Tosca brings the window to the foreground. You can add either a leading or trailing wildcard, i.e. a wildcard at the start or at the end of a string. |
Keys |
Keyboard command that you want to send to the window. By default, the DataType is RawString. Tosca sends RawString data exactly as entered to the system under test. No need to escape special characters. Tosca uses the WinForms function SendKeys. For a list of available SendKeys commands and their syntax, see the Microsoft SendKeys documentation: http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.aspx. If you activate CAPS LOCK on your machine, Tosca sends the keys inverted. For example, if you want to send Abc and have CAPS LOCK on, Tricentis Tosca sends aBC. By default, F6 is the key to cancel test runs. So, if you want to send F6 to your application as part of a test case, you must first change the default cancel key in the Tosca settings. Otherwise, Tosca cancels the test run when it gets to the test step that sends F6. |
![]() |
To use dynamic expressions in your keyboard commands, select the DataType String |
![]() |
In this example, you send a value and several keyboard commands to the file Example_Send_Key.txt. Use the DataType RawString for all Keys ModuleAttributes.
TBox Send Keys example |
TBox Window Operation
The Module TBox Window Operation sends specific commands to a window.
It has the following ModuleAttributes:
ModuleAttribute |
Description |
---|---|
Caption of the window that you want to steer. This caption identifies the window. |
|
Child Window Caption |
Caption of the child window that you want to steer. This caption identifies the child window. |
Operation |
Command for steering the control. You can choose from the operations described in the table below. |
Operation->Height |
Required height of the window in pixel. This ModuleAttribute is mandatory if you have selected the operation Resize. |
Operation->Width |
Required width of the window in pixel. This ModuleAttribute is mandatory if you have selected the operation Resize. |
Specify the window that Tosca should apply the specified Operation to. This ModuleAttribute is optional, but useful if the Caption that you have specified applies to more than one window. For instance if you use a wildcard. |
Operations
Tosca supports the following operations:
Description |
|
---|---|
Instructs Tosca to bring the window to the front. Bringing a window to the front might take longer depending on the complexity of the window UI and your machine's performance. Tricentis recommends to add a TestStep after this operation so that Tosca waits until a control on the window is visible before executing the next TestStep, as shown in the example. |
|
Close |
Closes the window. |
Maximize |
Maximizes the window. |
Minimize |
Minimizes the window. |
Move to Center |
Moves the window to the center of the screen. |
Normal |
Restores the window to its original size. |
Re-sizes the window to the height and width that you have specified in the ModuleAttributes Height and Width, respectively. |
|
Brings the window to the front but if unsuccessful goes on to your next TestStep. Your automation continues and Tosca shows the Try Bring To Front TestStep as failed. |
|
Verify Window Exists |
Verifies whether the specified window is open. |
Verifies whether the specified window is closed. |
|
Wait On Close |
This operation requires the ActionMode WaitOn. It has two different behaviors:
|
Wait On Open |
This operation requires the ActionMode WaitOn. It has two different behaviors:
|
![]() |
In this example, you have more than one window open. The caption of all open windows starts with Test file. You want to close the second window.
Close a specific window |
![]() |
In this example, you have a parent window and its child window open, and only maximize the child window.
Maximize a child window |
TBox Scroll Window Operation
The Module TBox Scroll Window Operation allows you to define scrolling behavior.
It has the following ModuleAttributes:
ModuleAttribute |
Description |
---|---|
Caption |
Caption of the application window that Tosca should scroll. This caption identifies the application window. |
Window Index |
Specifies the window (based on the opening order) that Tosca should scroll. This ModuleAttribute is optional, but useful if the Caption that you have specified applies to more than one window. For instance if you use a wildcard. |
Vertical |
Specifies in pixels (px) or lines (lines) how far Tosca scrolls along the vertical axis. If you specify a number without a unit of measurement, the page scrolls for the number of mouse wheel notches. |
Horizontal |
Specifies in pixels (px) or lines (lines) how far Tosca scrolls along the horizontal axis. If you specify a number without a unit of measurement, the page scrolls for the number of mouse wheel notches. Note that this ModuleAttribute only works if horizontal scrolling is supported by the application window. |
MousePolicy |
Specifies where Tosca should position the mouse pointer during scrolling. Enter one of the following values: Center (default), None. |
DirectionPolicy |
Specifies whether Tosca should scroll along the vertical or horizontal axis first. Enter one of the following values: NoDirectionPolicy (default), HorizontalFirst, VerticalFirst. |
Delay |
Specifies the time in milliseconds (ms) that Tosca should wait between scrolling along the vertical and horizontal axis. |
![]() |
In this example, Tosca performs the following actions:
TBox Scroll Window Operation example |
TBox Save As
The Module TBox Save As steers the dialog window Save As. To steer it, the Save As dialog has to be open.
It has the following ModuleAttributes:
ModuleAttribute |
Description |
---|---|
Caption |
Caption of the Save As dialog that you want to steer. Tricentis Tosca identifies the dialog from the caption in the upper section of the screen (WindowText). You can enter any string. This ModuleAttribute is mandatory. |
FileNameLabel |
Label of the input field where you enter the path in the Save As dialog. You only need to specify the label if the input field is NOT File name. If the label is File name, Tosca steers it automatically. You can enter any string. |
FilePath |
Path where Tosca saves the file. This ModuleAttribute is mandatory. |
Button |
Specify which button Tosca should click. Tosca steers Save or Cancel automatically. You only need to specify the button if the button is NOT Save or Cancel. This ModuleAttribute is optional. |
ConfirmationPopupCaption |
Caption of the modal dialog window. This allows you to steer modal dialog windows, for instance a confirmation dialog or an overwrite dialog if the file already exists. You can only confirm the modal dialog. Enter any string to specify the caption of the modal dialog. This ModuleAttribute is optional. |
ConfirmationPopupButton |
Specifies the confirmation button in the dialog specified in the ModuleAttribute ConfirmationPopup. You can enter any string. Tosca steers Ja, Yes, or OK automatically. You only need to specify the button if the button is NOT Ja, Yes, or OK. |
![]() | This example shows how to steer a Save As dialog. Tosca Commander performs the following actions:
TBox Save As example |