Button

Description

The button class represents one of the most common UI elements, anything that can be clicked to trigger an effect. Not only text buttons fall into this category, but for example icons, tool selections, links, etc.

A Button can be identified either by a text (e.g. the caption of the button) or by one or several images. Often buttons have several states that have different representation in addition to the default look, such as disabled, activated or highlighted. The button class offers to distinguish between theses states by separating the representation images in active and inactive. Then you can use the IsActive or WaitForStatus methods to check for a certain state. There can be also several active and inactive representations of the button, in this case make sure to put the corresponding images in sub-folders and pass the corresponding ImageReferences to the Button constructor.

Button Class

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

Inheritance Hierarchy:

Object Progile.TRIO.BaseModel.OnScreenElement Progile.TRIO.BaseModel.Button

Constructors

Button(ITester, string, ImageReference, bool, IImageFilter[ ])

Creates a new Button instance, that can be found with an image search for the activeImageReference within the provided filters. If button has active and inactive states, use the constructor with both activeImageReference and inactiveImageReference parameters instead.

Syntax:

public Button(
        ITester tester, 
        string displayName, 
        ImageReference activeImageReference, 
        bool useVisualSense, 
        params IImageFilter[] filters
)

Parameter

Description

tester

Type: ITester

The tester interface.

displayName

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

activeImageReference

Type: ImageReference The image reference that will be used to locate the button on the screen.

useVisualSense

Type: Boolean True if VisualSense should be used to find the element

[filters]

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

Button(ITester, string, ImageReference, ImageReference, bool, IImageFilter[ ])

Creates a new Button instance, that can be found with an image search for either the active or inactive image reference within the provided filters. The active and inactive image references are used to check for the button state with IsActive, WaitForActive and WaitForInactive.

Syntax:

public Button(
        ITester tester, 
        string displayName, 
        ImageReference activeImageReference, 
        ImageReference inactiveImageReference, 
        bool useVisualSense, 
        params IImageFilter[] filters
)

Parameter

Description

tester

Type: ITester

The tester interface.

displayName

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

activeImageReference

Type: ImageReference The active image reference that will be used to locate the button on the screen.

[inactiveImageReference]

Type: ImageReference The inactive image reference of the button. Will also be used to locate the button on the screen.

useVisualSense

Type: Boolean True if VisualSense should be used to find the element

[filters]

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

Button(ITester, string, string, bool, IImageFilter[ ])

Creates a new Button instance, that can be found with a text search for searchText within the provided filters.

Syntax:

public Button(
	ITester tester,
	string displayName,
	string searchText,
	bool useVisualSense,
	params IImageFilter[] filters
)

Parameter

Description

tester

Type: ITester

The tester interface.

displayName

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

serachText

Type: String The searchText that will be used to locate the button on the screen.

useVisualSense

Type: Boolean True if VisualSense should be used to find the element

[filters]

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

Methods

Name

Description

Clicks on the button. Verifies the click was successful with the specified verification and performs retries if necessary.

Clicks on the button and uses an update check in the provided filters as verification. Should only be used if no other verify method is applicable. If after the click no update is detected in the region defined by filters, retries are performed. Note: filters should be chosen so that hover / click effects of the button itself don't trigger the update.

Performs a double click on the button. Wait time between the individual clicks is controlled by the optional parameter doubleClickDelay.

Moves the mouse over the button. Verifies the hover was successful with the specified verification and performs retries if necessary.

Checks the state of the button. Returns true if the button is active, false if the button is inactive. Requires that images named "active" and "inactive" are present in the folder given as content.

Waits for the active status. Returns false if the status is not reached after OnScreenElement.WaitTimeInSeconds.

Waits for the active status. Returns false if the status is not reached after the given waitTime.

Waits for the inactive status. Returns false if the status is not reached after OnScreenElement.WaitTimeInSeconds.

Waits for the inactive status. Returns false if the status is not reached after waitTime.

Properties

Name

Description

Configure how much the mouse should move away after clicking. Use if the Button has a Mouseover Tooltip which hides to Button, so no retry can be executed. Set a custom Point or use for example t.Properties.MouseClickApproachOffset

Default: Point.Empty, so the mouse does not move away after clicking.

If true the mouse moves with a slow approach to the point before clicking, using the t.Properties.MouseClickApproachOffset. If false the mouse jumps immediately to the point and clicks.

Default: true

Last updated