TextBox

Description

The TextBox class represents an input field where a user can enter text and/or that displays text. Text is entered by clicking in the input field (defined by the Hotspot of the image given in the constructor), selecting all the text and typing the required text.

Text in the TextBox is read or verified either through the clipboard or with the help of the OCR algorithm, depending on the TextBoxType.

This primitive assumes that keyboard navigation (Ctrl-A, end, home etc.) is supported.

TextBox Class

Namespace: Progile.TRIO.BaseModel Assembly: Progile.TRIO.BaseModel (in Progile.TRIO.BaseModel.dll)

Inheritance Hierarchy:

Object Progile.TRIO.BaseModel.OnScreenElement Progile.TRIO.BaseModel.TextBox

Constructors

Creates a new TextBox instance. The textbox is defined by the Hotspot of imageName which can be found with the provided filters.

Textbox(IAppBasics, string, ImageReference, IImageFilter[])

Syntax:

public TextBox(
	IAppBasics appBasics,
	string displayName,
	ImageReference imageReference,
	params IImageFilter[] filters
)

Parameter

Description

appBasics

Type: Progile.TRIO.BaseModel.IAppBasics

The interface for the AppBasics, that is available on every BaseScreen. Allows access to the testerinterface and the system interactions.

displayName

Type: String The name of the element that will be used for logging and reporting of exceptions (customer facing).

imageReference

Type: ImageReference The image that will be used to locate the TextBox on the screen. The hotspot of the image must be set within the textbox border.

filters

Type: IImageFilter[ ] Typically a Select filter indicating the area of interest for the image search.

Textbox(ITester, ISystemHelpers, string, ImageReference, IImageFilter[])

Syntax:

public TextBox(
	ITester tester,
	ISystemHelpers systemHelpers,
	string displayName,
	ImageReference imageReference,
	params IImageFilter[] filters
)

Parameter

Description

tester

Type: ITester

The tester interface.

systemHelpers

Type: ISystemHelpers

Access to the SUT system specific shortcuts for select all text, copy, paste, etc.

displayName

Type: String The name of the element that will be used for logging and reporting of exceptions (customer facing).

imageReference

Type: ImageReference The image that will be used to locate the TextBox on the screen. The hotspot of the image must be set within the textbox border.

filters

Type: IImageFilter[ ] Typically a Select filter indicating the area of interest for the image search.

Methods

Name

Description

Clicks the out of TextBox, slightly to the left, to take away the focus of the box.

Clicks in the textbox (using hotspot of locationImage), selects all and types the text. Supports empty text (=delete) and multiple lines (use \n). If clickOutAfterType is true, it clicks in the middle of the loactionImage to take focus away from textbox.

The text that is entered is verified to ensure the complete text was correctly entered. If the verify fails, the configured amount of retries (RetryCount) are performed.

Enters text in a textbox but does not verify if anything was entered at all. Only use this if there is really no way to verify the enterd text with Enter. For blind password entry use PwTextBox.Enter() instead which at least verifies that the correct number of characters were entered

Copies or reads the text from TextBox (depending on the TextBoxType) and returns it as string. NOTE: Might not work correctly with empty textboxes (esp. for TextBoxType Clipboard)! If textbox is expected to be empty, use VerifyText("") before GetText() to check if it is empty.

Pastes the text from the internal clipboard to the text box. Overwrites what was in the text box before.

Verifies if the text in the textbox is the same as the expectedText. If not, provides the actual text read from the Textbox in actualText.

Verifies if the text in the textbox is the same as the expectedText.

Properties

Name

Description

Determines wether we should click out of the textbox after typing to take away focus of the textbox and thus confirming the value. Default: true

Determines wether we should click out of the textbox before using ocr on the textbox to avoid detecting the cursor as a character. Default: true

The default Textbox type if nothing else is configured. Default is Clipboard. Set this to OCR if SUT doesn't support clipboard transfer.

The tolerance to use in the SelectFromColorAtPoint method when defining the TextBoxSelect.

Indicates whether the Text property containing the content of the textbox as it is known to the model was read from the SCREEN, SET by the model itself (e.g. enter Text) or is UNKNOWN.

The content of the textbox as it is currently known to the model. Use DataSource Enum to see where the model got this information.

The ocr paras that are used to get or verify text in the box. Only applies to TextBoxType OCR.

The select filter containing the textbox input rectangle defined by the closed border around the hotspot of the location image given in the designer. This Select is used to read and verify Text for TextBoxType OCR.

Determines wether OCR or the clipboard shall be used to get or verify text in the textbox. Default: DefaultType

Last updated