OnScreenElement
Last updated
Was this helpful?
Last updated
Was this helpful?
The general idea of the BaseModel is that everything that is shown on the screen inherits from the . The most important functionalities supported by the class are the possibility to wait for the element, which ensures the element is displayed on the screen before interacting with it, and the method, which ensures the interactions with the element are verified and retried if necessary.‌
Namespace: Progile.TRIO.BaseModel Assembly: Progile.TRIO.BaseModel (in Progile.TRIO.BaseModel.dll)‌
​ Progile.TRIO.BaseModel.OnScreenElement‌
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.
Exception
Condition
ArgumentNullException
testerInterface, displayName and imageReference cannot be null or empty.
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.
Exception
Condition
ArgumentNullException
testerInterface, displayName and imageReference cannot be null or empty.
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.
Exception
Condition
ArgumentNullException
testerInterface, displayName and searchText cannot be null or empty.
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.
Exception
Condition
ArgumentNullException
testerInterface, displayName and searchText cannot be null or empty.
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);
)
Name
Description
The implementation for WaitFor that performs the actual search of the element on the screen.
WaitFor
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.
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
Type: ​
Type:
Type: Set to true if VisualSense should be used to find the element
Type:
Type: ​
Type:
Type:
Type: ​
Type:
Type: Set to true if VisualSense should be used to find the element
Type:
Type: ​
Type:
Type:
​​
Determines whether the element is currently shown on the screen using the method with a very short wait time.
Uses the provided (if available) to find the OnScreenElement in a scrollable area. If the element is not found at current position, scrolls to top and then down in steps.
Adds the select filter to or replaces any existing filter. Other in are not changed.
​​
​​
Waits for the element to appear on screen and returns an . If the element is found, it will call the method to initialize potential child elements that depend on the Position found by WaitFor. By default throws an exception if the element is not found after .
​​
​​
Waits for the element to disappear from the screen. Returns false if element is still found after .
Waits for the element to disappear from the screen or any element from elements to appear.
This is often used as verify method of an interaction that closes a dialog or similar but can also show a warning instead.
Returns false if this
element is still found after and no element from elements was found. Will return the element that was found in foundElement.
​​
Waits for a specific imageReference of the element to appear on screen and returns an . This method is intended for elements like Button or Checkbox to Wait for a certain state (like inactive or checked). If the image reference is found, it will call the Initialize method to initialize potential child elements that depend on the Position found by WaitFor. If imageReference is null, it behaves like . By default throws an exception if element is not found after waitTime.
​​
Executes the specified interact method on the element and verifies the interaction with the verify function. Performs retries if the verify is not successful.
​​
Initializes potential child controls on this Element. This method is called when () did find the element. Has no implementation on OnScreenElement.
​​
How long to wait for the element to disappear from the screen. Defaults to .
​​
​​
The which contains this element. This is used to wait for the parent screen before finding this element.
Typically this property is directly set to the screen (this
) from which the element is instantiated.
​​
The search result of . Gives the with the Position of the image or text that locates the element on the screen. Is only set if WaitFor succeeded, thus it should always be Position.HasSucceeded() = true;
​​
​​
​​
How long to wait for the element to appear on screen. Defaults to .
The delay to wait before a retry in miliseconds. Defaults to ​
The (Image or Text) that will be used to locate the element on the screen.