Class
ElementFinder

Provides infrastructure for accessing elements defined by FindParamAttribute on test methods and classes. Replaces the Find.Elements dictionary which has been obsoleted.

Definition

Namespace:ArtOfTest.WebAii.Core

Assembly:ArtOfTest.WebAii.dll

Syntax:

cs-api-definition
public class ElementFinder

Inheritance: objectElementFinder

Constructors

ElementFinder(Manager, object)

Create a new ElementFinder against a specific class instance

Declaration

cs-api-definition
public ElementFinder(Manager manager, object classInstance)

Parameters

manager

Manager

The manager object

classInstance

object

The class instance

Properties

ReturnElementProxyWhenNotFound

Gets or sets a flag that indicates to the ElementFinder to return an ElementProxy object when the element is not found instead of null or an exception. The Element proxy object is an Element object that is only initialized with the FindParam object it needs to use. You can then call Element.Wait.ForExists() on it to wait for it to be found. You can check whether an Element is a proxy element by checking the Element.IsProxy

Declaration

cs-api-definition
public bool ReturnElementProxyWhenNotFound { get; set; }

Property Value

bool

WaitOnElements

Gets or sets whether to wait on elements to exist in the DOM tree if they can't be found initially. If set, will use the WaitOnElementsTimeout as the default timeout for the wait. Default is false Note: This property overrides ReturnElementProxyWhenNotFound if set.

Declaration

cs-api-definition
public bool WaitOnElements { get; set; }

Property Value

bool

WaitOnElementsTimeout

Gets or sets the timeout to use when waiting on elements. WaitOnElements=true.

Declaration

cs-api-definition
public int WaitOnElementsTimeout { get; set; }

Property Value

int

Methods

Get(string)

Get an element defined by a FindAttribute.

Declaration

cs-api-definition
public ITargetElement Get(string elementKey)

Parameters

elementKey

string

The FindAttribute to use to locate the element.

Returns

ITargetElement

The element from the DOM or a proxy element that can be used later for another search.

GetHtml(string)

Get an HTML element

Declaration

cs-api-definition
public Element GetHtml(string elementKey)

Parameters

elementKey

string

The key as defined by the Find() attribute.

Returns

Element

The Element object.

GetHtml<T>(string)

Get an HTML element.

Declaration

cs-api-definition
public T GetHtml<T>(string elementKey) where T : Control, new()

Parameters

elementKey

string

The key as defined by the Find() attribute.

Returns

T

The control.

GetXaml(string)

Get a Xaml element.

Declaration

cs-api-definition
public FrameworkElement GetXaml(string elementKey)

Parameters

elementKey

string

The element key as defined by the Find() attribute

Returns

FrameworkElement

The found element

GetXaml<T>(string)

Get a Xaml element

Declaration

cs-api-definition
public T GetXaml<T>(string elementKey) where T : FrameworkElement

Parameters

elementKey

string

The key as defined by the Find() attribute

Returns

T

The found element

Merge(Type)

Merge a set of FindAttribute declarations defined on a type. The parameters will be available using Get, GetHtml or GetXaml

Declaration

cs-api-definition
public void Merge(Type typeToMerge)

Parameters

typeToMerge

Type