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 execution, you can view the screenshot in the Detail column of the ExecutionEntry.
The Module TBox Take Screenshot has the following ModuleAttributes:
ModuleAttribute |
Description |
---|---|
Environment |
Select from the drop-down menu whether you want to take a screenshot of your desktop or mobile device . If you leave the value empty, Tricentis Tosca takes a screenshot of the desktop. |
Directory |
Path to the screenshot. If you don't specify a path, Tricentis Tosca uses the storage path defined in the setting Screenshot directory. |
Filename |
Name of the screenshot. This name doesn't include the file extension. You can define the file format in the setting Screenshot image format. |
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 text that's in your clipboard or to save that text to a buffer.
It has the following ModuleAttribute:
ModuleAttribute |
Description |
---|---|
Value |
Value that you want to copy to the clipboard, verify, or buffer. Depending on the desired action, use ActionMode Input, Verify, or Buffer, 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 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 Tricentis 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 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 |
Caption of the window that you want to steer. This is optional. If you enter a caption, Tricentis 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. Tricentis 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, Tricentis Tosca sends the keys inverted. For example, if you want to send Abc and have CAPS LOCK on, Tricentis Tosca sends abC. |
If you use special characters in your commands, you need to escape them. For more information, see chapter "Special characters". |
In this example, you send a value and several keyboard commands to the file Example_Send_Key.txt. The double quotation marks that enclose specific commands escape the special characters within the command.
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. |
|
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 Tricentis 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
Tricentis Tosca supports the following operations:
Description |
|
---|---|
Bring To Front |
Brings the window to the front. |
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. |
|
Verify Window Exists |
Verifies whether the specified window is open. |
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 |
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 Commander steers it automatically. You can enter any string. |
FilePath |
Path where Tosca Commander saves the file. This ModuleAttribute is mandatory. |
Button |
Specify which button Tosca Commander should click. Tosca Commander 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 Commander 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 |