OnScreenElement Methods
Last updated
Was this helpful?
Last updated
Was this helpful?
This method is used to clone an element when finding all instances with . The returned elements are in general shallow clones of the original element, however for elements with sub-elements (e.g. ) those should be cloned in an override.
A clone of the element.
Finds all instances of the element that are visible on the screen and returns them as a list of . The returned elements all have set to true, so that the respective position is used when we interact with the element. The returned elements are in general shallow clones of the original element, however for elements with sub-elements (e.g. ) those should be cloned in an override of the method.
A list of elements corresponding to all positions where the element was found on the screen.
Exception
Condition
When the element is not found at all.
Finds all instances of the element that are visible on the screen.
Exception
Condition
When the element is not found at all.
Syntax:
Parameter
Description
scroller
[throwException]
[waitTime]
Exception
Condition
When the element is not found after scrolling through the complete range, and throwException is true
or not set.
Parameter
Description
select
Returns a string that represents this instance, usually the DisplayName. Used for logging; just use $"{this}"
.
Parameter
Description
[throwException]
[waitTime]
Exception
Condition
When the element is not found, and throwException is true
or not set.
Parameter
Description
foundElement
elements
True, if this
element disappeared or an element from elements was found. Otherwise false.
Exception
Condition
ArgumentNullException
When elements is null or an empty list.
Parameter
Description
waitTime
imgRef
Parameter
Description
imageReference
The image reference that will be used to locate the element on the screen.
[throwException]
[waitTime]
Exception
Condition
When the element is not found, and throwException is true
or not set.
Parameter
Description
interact
verify
Exception
Condition
When verify returned false even after the retries.
Parameter
Description
interact
verify
recovery
Exception
Condition
When verify returned false even after the retries.
When the element is not found at all. (In the case that the element is derived from )
A list of all positions () where the current element was found on the screen.
When the element is not found at all. (In the case that the element is derived from )
Determines whether the element is currently shown on the screen, using the method with a very short wait time. 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.
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.
Type: The scroller that shall be used to find the elemnt. Typically the scroller is a property on the screen object containing the element.
Type:
if set to false
, returns a failed IEngineResult instead of throwing an exception.
Type:
For how long the element should be searched before each scroll action. If not set or set to default(TimeSpan)
, only 1 search is performed before scrolling again (recommended).
The of the search for the element.
Adds the select filter to or replaces any existing filter. Other in are not changed. If was not yet defined, it is created by this method. Invalid or empty filters are ignored by this method and the property is not changed.
Type: The new Select filter to be used for this element.
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 .
Type:
if set to false
, returns a failed IEngineResult instead of throwing an exception.
Type:
For how long the element should be searched. If not set or set to default(TimeSpan)
, the property is used.
The of the search for the element.
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 does not log.
Waits for the element to disappear from the screen. Returns false if element is still found after .
Can be used as verify function without lambda operator (e.g. Buttton.Click(element.WaitForDisappear);
)
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.
Type:
The element that was found or null, if this
element disappeared.
Type: [] A list of elements that can appear instead of this element disappearing. Typically warnings, confirmation or failure notification.
The implementation for that performs the actual search of the element on the screen.
Type: For how long the element should be searched.
Type:
A specific image representation to wait for, or null to wait for
The of the search for the element.
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 imageReference is null, behaves like If the imageReference 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 .
Type:
Type:
if set to false
, returns a failed IEngineResult instead of throwing an exception.
Type:
For how long the element should be searched. If not set or set to default(TimeSpan)
, the property is used.
The of the search for the element.
Executes the specified interact method on the element and verifies the interaction with the verify function. Performs retries if the verify is not successful.
Type: The interaction that should be performed and retried if verify was not successful.
Note: Ensure that the interact can be executed more than once or set to 1.
Type: <> The verification method that will decide whether the interaction was successful or it should be retried.
Executes the specified interact method on the element and verifies the interaction with the verify function. Performs retries if the verify is not successful. Before each retry, a recovery action is executed.
Type: The interaction that should be performed and retried if verify was not successful.
Note: Ensure that the interact can be executed more than once or set to 1.
Type: <> The verification method that will decide whether the interaction was successful or it should be retried.
Type: The action that should be performed if the verify failed before doing a retry. This can be used to make sure the state of the element is the same as before the first interact (e.g. Click out to unfocus, close DropdownList, etc)
Initializes potential child controls on this Element. This method is called when () did find the element. Has no implementation on OnScreenElement.