Tricentis Tosca 16.0 Released on Feb-2023 ----- UFT has been upgraded from UFT 15.0.1 to UFT One 15.0.2, Beginning at November 2020.

Saturday, 1 July 2023

Basic Windows Operations

Windows Operations allows you to perform special tasks in the Tosca. It contains the following modues.

  1. TBox Take Screenshot

  2. TBox Clipboard

  3. TBox Dialog

  4. TBox Send Keys

  5. TBox Window Operation

  6. TBox Save as

TBox Take Screenshot

TBox Take Screenshot 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:

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.

Example :: 

Take a screenshot of your desktop, Save it to the directory D:\Screenshots and Give this screenshot the name as Screen1.

Note - Module name is TBox Take Screenshot

TBox Clipboard

TBox Clipboard 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:

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.

Example

  • The first TestStep copies the value Sample text to the clipboard.

  • The second TestStep verifies whether the value in your clipboard is Sample text.

TBox Send Keys

The TBox Send Keys module sends the keyboard commands to any opened window or screen or web page.

The TBox Send Keys has the following ModuleAttributes:

Caption --  This is optional attribute, The captin of the window or page or screen to be steered is entered here.

You can add either a leading or trailing wildcard, i.e. a wildcard at the start or at the end of a string.

Key - This module attribute specifies the value to be used for steering.

NOTE -- Always put keyboard commands in curly brackets between inverted commas.

Below are the command codes corresponding to the keys shown in the below table.

KeyCode
BACKSPACE{BACKSPACE}, {BS}, or {BKSP}
BREAK{BREAK}
CAPS LOCK{CAPSLOCK}
DEL or DELETE{DELETE} or {DEL}
DOWN ARROW{DOWN}
END{END}
ENTER{ENTER} or ~
ESC{ESC}
HELP{HELP}
HOME{HOME}
INS or INSERT{INSERT} or {INS}
LEFT ARROW{LEFT}
NUM LOCK{NUMLOCK}
PAGE DOWN{PGDN}
PAGE UP{PGUP}
PRINT SCREEN{PRTSC} (reserved for future use)
RIGHT ARROW{RIGHT}
SCROLL LOCK{SCROLLLOCK}
TAB{TAB}
UP ARROW{UP}
F1{F1}
F2{F2}
F3{F3}
F4{F4}
F5{F5}
F6{F6}
F7{F7}
F8{F8}
F9{F9}
F10{F10}
F11{F11}
F12{F12}
F13{F13}
F14{F14}
F15{F15}
F16{F16}
Keypad add{ADD}
Keypad subtract{SUBTRACT}
Keypad multiply{MULTIPLY}
Keypad divide{DIVIDE}

Example - 

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.



^(a) - Sends the command Select all to the window.

"{DEL}" - Sends the command Delete to the window.

^(s) - Sends the command Save to the window.

%"{F4}" - Sends the command Close window to the window.

TBox Window Operation

The TBox Window Operation Module can be used to send specific commands to a window relating to intended operation.

The TBox Window Operatin has the following ModuleAttributes:

CaptionThe captin of the window or page or screen to be steered is entered here.

OperationSpecify the command to be used for steering the control.

Operation->HeightThis is mandatory if you have selected the operation Resize. (Required height of the window in pixel).

Operation->WidthThis is mandatory if you have selected the operation Resize (Required width of the window in pixel.).

Window Index This is optional, but useful if the Caption that you have specified applies to more than one window. For instance if you use a wildcard. (Specify the window that Tricentis Tosca should apply the specified Operation to.)

Tricentis Tosca supports the following operations:

Bring To Front - Brings the window to the front.

CloseThis option closes the selected window.

MaximizeThis option maximizes the selected window.

MinimizeThis option minimizes the selected window.

Move to CenterMoves the window to the center of the screen.

Normal - Restores the window to its original size.

ResizeRe-sizes the window to the height and width that you have specified in the ModuleAttributes Height and Width, respectively.

Verify Window ExistsThis option invokes the system to verify if a specific window is open.

Wait On CloseThis option makes the system wait for a specific period until a window is closed.

Wait On OpenThis option makes the system wait for a specific period until a window is Opened.

Example :  More than one window open. The caption of all open windows starts with Test fileYou want to close the second 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:

Caption - This is mandatory. Caption of the Save As dialog that you want to steer. Tosca identifies the dialog from the caption in the upper section of the screen (WindowText). You can enter any string.

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 nameTosca Commander steers it automatically.You can enter any string.

FilePath - This is mandatory. Path where Tosca Commander saves the file.

ButtonThis is optional. 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.

ConfirmationPopupCaption - This is optional.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.

ConfirmationPopupButton - Specifies the confirmation button in the dialog specified in the Attribute ConfirmationPopup. You can enter any string.Tosca Commander steers JaYes, or OK automatically. You only need to specify the button if the button is NOT JaYes, or OK.


Example : - 

  1. Identifies the Save as dialog

  2. Saves the file test.txt to the path C:\Temp

  3. If the file already exists, Tosca Commander confirms the overwrite in the Confirm Save As dialog.