OnScreenElement
Description
The general idea of the BaseModel is that everything that is shown on the screen inherits from the OnScreenElement. The most important functionalities supported by the OnScreenElement class are the possibility to wait for the element, which ensures the element is displayed on the screen before interacting with it, and the Do method, which ensures the interactions with the element are verified and retried if necessary.
OnScreenElement Class (abstract)
Namespace: Progile.TRIO.BaseModel Assembly: Progile.TRIO.BaseModel (in Progile.TRIO.BaseModel.dll)
Inheritance Hierarchy:
Object Progile.TRIO.BaseModel.OnScreenElement
Constructors
OnScreenElement(ITester, string, bool ,ImageReference[])
Syntax:
Parameter
Description
tester
The tester interface.
displayName
The name of the element that will be used for logging and reporting of exceptions (customer facing).
useVisualSense
imageReference
One or multiple image references that will be used to locate the element on the screen.
Exceptions:
Exception
Condition
ArgumentNullException
testerInterface, displayName and imageReference cannot be null or empty.
OnScreenElement(ITester, string, ImageReference[])
Syntax:
Parameter
Description
tester
The tester interface.
displayName
The name of the element that will be used for logging and reporting of exceptions (customer facing).
imageReference
One or multiple image references that will be used to locate the element on the screen.
Exceptions:
Exception
Condition
ArgumentNullException
testerInterface, displayName and imageReference cannot be null or empty.
OnScreenElement(ITester, string, bool, string)
Syntax:
Parameter
Description
tester
The tester interface.
displayName
The name of the element that will be used for logging and reporting of exceptions (customer facing).
useVisualSense
searchText
The searchText that will be used to locate the element on the screen.
Exceptions:
Exception
Condition
ArgumentNullException
testerInterface, displayName and searchText cannot be null or empty.
OnScreenElement(ITester, string, string)
Syntax:
Parameter
Description
tester
The tester interface.
displayName
The name of the element that will be used for logging and reporting of exceptions (customer facing).
searchText
The searchText that will be used to locate the element on the screen.
Exceptions:
Exception
Condition
ArgumentNullException
testerInterface, displayName and searchText cannot be null or empty.
Methods
Name
Description
Finds all instances of the element that are visible on the screen.
Note: Do not use this if you expect the element to appear after an action (e.g. as verify method of another action), only if the screen is expected to be static.
Returns a string that represents this instance, usually the DisplayName. Used for logging; just use $"{this}"
.
Shorthand notation for WaitFor(false).HasSucceeded;
Can be used as verify function without lambda operator (e.g. Buttton.Click(element.WaitForDisappear);
)
Note: This method logs, whereas WaitFor() does not log.
Can be used as verify function without lambda operator (e.g. Buttton.Click(element.WaitForDisappear);
)
Protected Methods
Name
Description
The implementation for WaitFor that performs the actual search of the element on the screen.
WaitFor
Properties
Name
Description
Default value for DisappearWaitTimeInSeconds of new OnScreenElements. Default is 20 seconds.
Default value for WaitTimeInSeconds of new OnScreenElements. Default is 60 seconds.
The image filters that will be used to find the element on screen (e.g. Select filter to limit the search to a specific rectangle). Should be used in all methods on derived elements for finding the element.
Parameters for the image search to find the element on screen. Should be used in all methods on derived elements for finding the element.
Determines how many times an interaction shall be attempted, 1 meaning 1 attempt, so no retries. Default = 3.
Parameters for the text search to find the element on screen. Should be used in all methods on derived elements for finding the element.
Protected Properties
Name
Description
DisplayName
The name of the element that will be used for logging and reporting of exceptions (customer facing).
RetryDelay
FindElementBeforeRetry
Determines whether the element should be searched again before doing a retry. Default is false, however most predefined Elements such as Button and TextBox have this property set to true.
ImageReferences
The image reference(s) that will be used to locate the element on the screen.
SearchText
The search text that will be used to locate the element on the screen.
SearchType
Last updated
Was this helpful?