TestResults.io
  • What is TestResults.io
  • System Architecture
  • Regulated Markets
    • Health Care Industry
    • Financial Services Industry
  • What's new?
    • Update Instruction
      • Update of the Designer extension in Visual Studio
      • Update the Execution Engine
      • Update the Base- and Environment Models
    • Migration to new project file
  • Designer
    • Overview
    • First Steps
    • Installation
    • TestResults.io solution
    • The development environment
      • Tool Window Overview
        • Test Environments
          • Steps to configure a SUT VM
          • How to access files on the system under test
        • Remote Viewer
          • Control Mode
          • Capture Mode
          • Screen Editor
          • Capture Single Image
        • Screen Explorer
        • Test Case Designer
        • Image Explorer
        • API Testing
        • TestResults.io options
          • Engines
          • Servers
    • Test Cases
      • Adding Test Cases
      • Test Case structure
      • Simple Test Case (Example)
      • Executing your Test Case
      • Generating Test Containers
      • Publishing Test Cases
      • Execution Variables
    • Software Models
      • Adding SW Models
      • Referencing the Model in the Test Case
      • Generating Test Containers
      • Publishing SW Models
      • Screens and Screen Elements
        • Tables
        • Visual Sense
        • Custom Screen Elements
    • Installers
      • Adding Installers
      • Generating Test Containers
      • Publishing Installers
    • Automation Framework Reference
      • Attributes
      • Enumerations
      • Filters
        • IImageFilter Interface
        • Select
        • Resize
      • GlobalEngineParameters
      • ImageDetectionParameters
      • ImageReference
      • Interfaces
        • ITester Interface
          • ITester Methods
          • ITester Properties
        • ITestee Interface
          • ITestee Methods
        • IConnections Interface
          • IConnections Methods
          • IConnections Properties
        • IDebug Interface
        • IEngineResult
        • IHelpers Interface
        • IImageHelper Interface
          • IImageHelper Methods
        • IKeyboard Interface
          • IKeyboard Methods
        • IMouse Interface
          • IMouse Methods
          • IMouse Properties
        • IReport Interface
          • IReport Methods
        • ISUTConnection Interface
      • OcrEngineParameters
        • Best practise
        • IronOcrEngineParameters
        • LEADOcrEngineParameters
        • OcrEngineRelatedCharacters
        • OcrPreprocessingParameters
      • ResultRectangle
      • SutNotReadyException
      • TestStepAbortedException
    • FAQ
      • Two-factor authentication (2FA) and One Time Passwords (OTP)
      • Receive and verify Emails
      • Using Excel as test data source
      • Verify PDF Content
  • Portal
    • Overview
    • First Steps
    • User's Guide
      • Login
      • Projects
      • Dashboard
      • Test Cases
      • Software & Environments
      • Test Sets
      • Job Queue
      • Management
      • Notifications Summary
    • Automation Engineer's Guide
      • Test Automation Workflow
      • Automating a test case
      • Enabling Software & Environments
    • REST API Reference
      • Authentication
      • Projects
      • Test Sets
      • Test Cases
      • Test Plans
      • Test Reports
      • Files
      • Software
      • Environments
      • Untitled
      • Executions
      • Favorites
      • Statistics
      • User Management
      • Customer Management
      • Notifications
      • Configurations
      • Invoicing
  • Models
    • Overview
    • Base Model
      • BaseScreen
        • BaseScreen Properties
        • BaseScreen Methods
      • OnScreenElement
        • OnScreenElement Methods
        • OnScreenElement Properties
      • Primitives
        • Button
          • Button Methods
          • Button Properties
        • Checkbox
          • Checkbox Methods
        • ContextMenu
          • ContextMenu Methods
          • ContextMenu Properties
        • Dropdown
          • Dropdown Methods
          • Dropdown Properties
        • DropdownMenu
          • DropdownMenu Methods
          • DropdownMenu Properties
        • GenericScroller
          • GenericScroller Methods
          • GenericScroller Properties
        • HorizontalScroller
        • IconButton
          • IconButton Properties
        • Label
        • LabelWithButton
          • LabelWithButton Properties
        • LabelWithCheckbox
          • LabelWithCheckbox Properties
        • LabelWithValue
          • LabelWithValue Methods
          • LabelWithValue Properties
        • PwTextBox
          • PwTextBox Methods
        • TextBox
          • TextBox Methods
          • TextBox Properties
        • Tables and lists
          • Column
            • Column Methods
            • Column Properties
          • ItemList
            • ItemList Methods
            • ItemList Properties
          • Row
            • Row Methods
            • Row Properties
          • TableBase
            • TableBase Methods
            • TableBase Properties
        • LabelWithElementBase
          • LabelWithElementBase Properties
      • Enumerations
      • Extensions
        • EngineResultExtensions Methods
        • EnumExtensions Methods
        • ReportExtensions Methods
        • StringExtensions Methods
        • TesterConnectionExtensions Methods
        • TesterDebugExtensions Methods
        • TesterHelperExtensions Methods
        • TesterMouseExtensions Methods
        • TesterOnScreenElementExtensions
        • TesterSelectExtensions Methods
      • Helper Classes
        • BaseModelHelpers
          • BaseModelHelpers Methods
          • BaseModelHelpers Properties
        • Attributes for Designer
        • ListHelpers
      • Exceptions
        • ElementNotFoundException
        • InteractionFailedException
        • ScreenNotFoundException
      • Interfaces
        • IAppBasics Interface
          • IAppBasics Methods
          • IAppBasics Properties
        • IBrowser
        • ICommandLineWindow
        • IScroller Interface
          • IScroller Methods
          • IScroller Properties
        • ISutLocale Interface
          • ISutLocale Methods
          • ISutLocale Properties
        • ISystemHelpers
        • ISystemInteractions
        • IWindow
    • Environment Model
      • Windows
        • Screens
          • CmdWindow
            • CmdWindow Methods
            • CmdWindow Properties
          • FileDialog
            • FileDialog Methods
            • FileDialog Properties
          • FileExplorer
            • FileExplorer Properties
          • RunWindow
            • RunWindow Methods
            • RunWindow Properties
          • Window
            • Window Methods
            • Window Properties
        • SutLocale
          • SutLocale Methods
          • SutLocale Properties
        • SystemHelpers
          • SystemHelpers Methods
          • SystemHelpers Properties
        • SystemInteractions
        • WebBrowser
          • Browser
            • Browser Methods
            • Browser Properties
          • BrowserScroller
            • BrowserScroller Methods
            • BrowserScroller Properties
          • AuthenticationDialog
            • AuthenticationDialog Methods
            • AuthenticationDialog Properties
          • DownloadDialog
            • DownloadDialog Methods
            • DownloadDialog Properties
        • EnvironmentModel Enumerations
        • Interfaces
          • IWebAppBasics
            • IWebAppBasics Property
Powered by GitBook
On this page
  • CloneForMultipleInstances
  • FindAllInstances
  • FindAllInstances<T>
  • IsOnScreen
  • ScrollAndFindElement
  • SetSelectFilter
  • ToString
  • WaitFor
  • WaitForAppear
  • WaitForDisappear
  • WaitForDisappearOrOtherElement
  • Protected Methods
  • WaitForImpl
  • WaitFor (ImageReference, bool, TimeSpan)
  • Do (Action, Func<bool>)
  • Do (Action, Func<bool>, Action)
  • Initialize

Was this helpful?

  1. Models
  2. Base Model
  3. OnScreenElement

OnScreenElement Methods

PreviousOnScreenElementNextOnScreenElement Properties

Last updated 1 year ago

Was this helpful?

CloneForMultipleInstances

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.

Syntax:

public virtual OnScreenElement CloneForMultipleInstances()

Return Value:

A clone of the element.

FindAllInstances

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.

Syntax:

public IList<IEngineResult> FindAllInstances()

Return Value:

A list of elements corresponding to all positions where the element was found on the screen.

Exceptions:

Exception

Condition

When the element is not found at all.

FindAllInstances<T>

Finds all instances of the element that are visible on the screen.

Syntax:

public IList<IEngineResult> FindAllInstances()

Return Value:

Exceptions:

Exception

Condition

When the element is not found at all.

IsOnScreen

Syntax:

public bool IsOnScreen()

ScrollAndFindElement

Syntax:

public IEngineResult ScrollAndFindElement(
	IScroller scroller,
	bool throwException = true,
	TimeSpan searchTime = default
)

Parameters:

Parameter

Description

scroller

[throwException]

[waitTime]

Return Value:

Exceptions:

Exception

Condition

When the element is not found after scrolling through the complete range, and throwException is true or not set.

SetSelectFilter

Syntax:

public void SetSelectFilter(
	Select select
)

Parameters:

Parameter

Description

select

ToString

Returns a string that represents this instance, usually the DisplayName. Used for logging; just use $"{this}".

Syntax:

public string ToString()

WaitFor

Syntax:

public virtual IEngineResult WaitFor(
	bool throwException = true,
	TimeSpan waitTime = default(TimeSpan)
)

Parameters:

Parameter

Description

[throwException]

[waitTime]

Return Value:

Exceptions:

Exception

Condition

When the element is not found, and throwException is true or not set.

WaitForAppear

Syntax:

public bool WaitForAppear()

WaitForDisappear

Syntax:

public bool WaitForAppear()

WaitForDisappearOrOtherElement

Syntax:

public bool WaitForDisappearOrOtherElement(
    out OnScreenElement foundElement,
    params OnScreenElement[] elements
)

Parameters:

Parameter

Description

foundElement

elements

Return Value:

True, if this element disappeared or an element from elements was found. Otherwise false.

Exceptions:

Exception

Condition

ArgumentNullException

When elements is null or an empty list.

Protected Methods

WaitForImpl

Syntax:

protected virtual IEngineResult WaitForImpl(
    TimeSpan waitTime,
    ImageReference imgRef = null
)

Parameters:

Parameter

Description

waitTime

imgRef

Return Value:

WaitFor (ImageReference, bool, TimeSpan)

Syntax:

protected virtual IEngineResult WaitFor(
	ImageReference imageReference,
	bool throwException = true,
	TimeSpan waitTime = default(TimeSpan)
)

Parameters:

Parameter

Description

imageReference

The image reference that will be used to locate the element on the screen.

[throwException]

[waitTime]

Return Value:

Exceptions:

Exception

Condition

When the element is not found, and throwException is true or not set.

Do (Action, Func<bool>)

Syntax:

protected virtual void Do(
    Action interact,
    Func<bool> verify
)

Parameters:

Parameter

Description

interact

verify

Exceptions:

Exception

Condition

When verify returned false even after the retries.

Do (Action, Func<bool>, Action)

Syntax:

protected virtual void Do(
    Action interact,
    Func<bool> verify,
    Action recovery
)

Parameters:

Parameter

Description

interact

verify

recovery

Exceptions:

Exception

Condition

When verify returned false even after the retries.

Initialize

Syntax:

protected virtual void Initialize()

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.

IEngineResults
IScroller
IEngineResult
IEngineResult
IEngineResult
IEngineResult
WaitFor
WaitFor()
WaitFor
WaitFor
ElementNotFoundException
ScreenNotFoundException
BaseScreen
ElementNotFoundException
ScreenNotFoundException
BaseScreen
IScroller
Boolean
TimeSpan
ElementNotFoundException
Select
Boolean
ElementNotFoundException
OnScreenElement
OnScreenElement
TimeSpan
ImageReference
ImageReference
Boolean
ElementNotFoundException
Action
Func
Boolean
InteractionFailedException
Action
Func
Boolean
Action
InteractionFailedException
LabelWithCheckbox
OnScreenElement
LabelWithCheckbox
FindAllInstances
CloneForMultipleInstances
Select
filter types
Select
IEngineResult
Initialize
IEngineResult
WaitFor(bool, TimeSpan)
Initialize
TimeSpan
TimeSpan
UseCachedPosition
Filters
Filters
Filters
Filters
WaitTimeInSeconds
DisappearWaitTimeInSeconds
DisappearWaitTimeInSeconds
WaitTimeInSeconds
RetryCount
RetryCount
WaitTimeInSeconds
WaitTimeInSeconds
RetryCount
RetryCount
ImageReferences