Table of Contents

Interface IAdapter

Namespace
Ranorex.Core
Assembly
Ranorex.Core.dll

The interface for all role and capability adapters.

public interface IAdapter

Properties

Children

Gets the immediate children of this adapter.

IList<Unknown> Children { get; }

Property Value

IList<Unknown>

Element

The element associated with this adapter.

Element Element { get; }

Property Value

Element

Exceptions

CapabilityNotSupportedException

If setting the value of this property and the element does not support the capabilities required by this adapter.

Parent

Gets the parent of this adapter.

Unknown Parent { get; }

Property Value

Unknown

ScreenRectangle

The bounding rectangle of the element in screen coordinates.

Rectangle ScreenRectangle { get; }

Property Value

Rectangle

Visible

True if the element is visible.

bool Visible { get; }

Property Value

bool

Methods

As<T>()

Returns an adapter of the specified type for the underlying element of the current adapter.

T As<T>() where T : Adapter

Returns

T

The specified adapter or null if the underlying element does not provide the capabilites required for the adapter.

Type Parameters

T

The adapter type. The supplied type must inherit from Adapter, but most not be the Adapter type itself.

Filter<T>(IList<Element>)

Filters the given element list by the specified adapter type. The returned adapter list correspond to the elements that could be converted to the specified adapter type.

IList<T> Filter<T>(IList<Element> elements) where T : Adapter

Parameters

elements IList<Element>

A list of elements.

Returns

IList<T>

A list of adapter instances corresponding to the elements that could be converted to the specified adapter.

Type Parameters

T

The type of adapter to filter by. The supplied type must inherit from Adapter, but most not be the Adapter type itself.

Find(RxPath)

Applies a Ranorex Path to the adapter, returning all elements which match the path.

IList<Element> Find(RxPath path)

Parameters

path RxPath

The RxPath to apply.

Returns

IList<Element>

The result list of the path.

Find(RxPath, Duration)

Applies a Ranorex Path to the adapter, returning instances of a specific adapter type (e.g. Role or Capability).

IList<Element> Find(RxPath path, Duration timeout)

Parameters

path RxPath

The RxPath to apply.

timeout Duration

The time to keep looking for at least one element matching the path.

Returns

IList<Element>

The result list of the path.

FindChild<T>()

Finds an immediate child element of the given capability adapter type.

T FindChild<T>() where T : Adapter

Returns

T

The matching element adapter.

Type Parameters

T

The adapter type to use. The supplied type must inherit from Adapter, but most not be the Adapter type itself.

Exceptions

ElementNotFoundException

If no element is found.

FindChildren<T>()

Finds immediate child elements of the given capability adapter type.

IList<T> FindChildren<T>() where T : Adapter

Returns

IList<T>

A list of matching element adapters.

Type Parameters

T

The adapter type to use. The supplied type must inherit from Adapter, but most not be the Adapter type itself.

FindDescendant<T>()

Finds a descendant of the given capability adapter type.

T FindDescendant<T>() where T : Adapter

Returns

T

The matching element adapter.

Type Parameters

T

The adapter type to use. The supplied type must inherit from Adapter, but most not be the Adapter type itself.

Exceptions

ElementNotFoundException

If no element is found.

FindDescendants<T>()

Finds all descendants of the given capability adapter type.

IList<T> FindDescendants<T>() where T : Adapter

Returns

IList<T>

A list of matching element adapters.

Type Parameters

T

The adapter type to use. The supplied type must inherit from Adapter, but most not be the Adapter type itself.

FindSingle(RxPath)

Applies a Ranorex Path to the adapter, returning an Element.

Element FindSingle(RxPath path)

Parameters

path RxPath

The RxPath to apply.

Returns

Element

The first element found.

Exceptions

ElementNotFoundException

If no element is found.

FindSingle(RxPath, Duration)

Applies a Ranorex Path to the adapter, returning an Element.

Element FindSingle(RxPath path, Duration timeout)

Parameters

path RxPath

The RxPath to apply.

timeout Duration

The time to keep looking for the element.

Returns

Element

The first element found.

Exceptions

ElementNotFoundException

If no element is found within the timeout.

FindSingle<T>(RxPath)

Applies a Ranorex Path to the adapter, returning a specific adapter type (e.g. Role or Capability).

T FindSingle<T>(RxPath path) where T : Adapter

Parameters

path RxPath

The RxPath to apply.

Returns

T

The first element found converted to the specified adapter type.

Type Parameters

T

The expected adapter type. The supplied type must inherit from Adapter, but most not be the Adapter type itself.

Exceptions

ElementNotFoundException

If no element is found.

CapabilityNotSupportedException

If the element does not support the capabilities required by this adapter.

FindSingle<T>(RxPath, Duration)

Applies a Ranorex Path to the adapter, returning a specific adapter type (e.g. Role or Capability).

T FindSingle<T>(RxPath path, Duration timeout) where T : Adapter

Parameters

path RxPath

The RxPath to apply.

timeout Duration

The time to keep looking for the element.

Returns

T

The first element found converted to the specified adapter type.

Type Parameters

T

The expected adapter type. The supplied type must inherit from Adapter, but most not be the Adapter type itself.

Exceptions

ElementNotFoundException

If no element is found within the timeout.

CapabilityNotSupportedException

If the element does not support the capabilities required by this adapter.

Find<T>(RxPath)

Applies a Ranorex Path to the adapter, returning instances of a specific adapter type (e.g. Role or Capability).

IList<T> Find<T>(RxPath path) where T : Adapter

Parameters

path RxPath

The RxPath to apply.

Returns

IList<T>

The result list of the path.

Type Parameters

T

The expected adapter type. The supplied type must inherit from Adapter, but most not be the Adapter type itself.

Find<T>(RxPath, Duration)

Applies a Ranorex Path to the adapter, returning instances of a specific adapter type (e.g. Role or Capability).

IList<T> Find<T>(RxPath path, Duration timeout) where T : Adapter

Parameters

path RxPath

The RxPath to apply.

timeout Duration

The time to keep looking for at least one element matching the path.

Returns

IList<T>

The result list of the path.

Type Parameters

T

The expected adapter type. The supplied type must inherit from Adapter, but most not be the Adapter type itself.

TryFindSingle(RxPath, out Element)

Tries to apply a Ranorex Path to the adapter, returning an Element.

bool TryFindSingle(RxPath path, out Element foundElement)

Parameters

path RxPath

The RxPath to apply.

foundElement Element

The first element found or null if no element is found.

Returns

bool

True if an element is found for the specified path, otherwise false.

TryFindSingle(RxPath, Duration, out Element)

Tries to apply a Ranorex Path to the adapter, returning an Element.

bool TryFindSingle(RxPath path, Duration timeout, out Element foundElement)

Parameters

path RxPath

The RxPath to apply.

timeout Duration

The time to keep looking for the element.

foundElement Element

The first element found or null if no element is found within the timeout.

Returns

bool

True if an element is found for the specified path within the specified timeout, otherwise false.

TryFindSingle<T>(RxPath, Duration, out T)

Tries to apply a Ranorex Path to the adapter, returning a specific adapter type (e.g. Role or Capability).

bool TryFindSingle<T>(RxPath path, Duration timeout, out T foundAdapter) where T : Adapter

Parameters

path RxPath

The RxPath to apply.

timeout Duration

The time to keep looking for the element.

foundAdapter T

The first element found converted to the specified adapter type or null if no element is found within the timeout or the element does not support the capabilities to create the specified adapter type.

Returns

bool

True if an element is found for the specified path within the specified timeout and the specified adapter type could be created, otherwise false.

Type Parameters

T

The expected adapter type. The supplied type must inherit from Adapter, but most not be the Adapter type itself.

TryFindSingle<T>(RxPath, out T)

Tries to apply a Ranorex Path to the adapter, returning a specific adapter type (e.g. Role or Capability).

bool TryFindSingle<T>(RxPath path, out T foundAdapter) where T : Adapter

Parameters

path RxPath

The RxPath to apply.

foundAdapter T

The first element found converted to the specified adapter type or null if no element is found or the element does not support the capabilities to create the specified adapter type.

Returns

bool

True if an element is found for the specified path and the specified adapter type could be created, otherwise false.

Type Parameters

T

The expected adapter type. The supplied type must inherit from Adapter, but most not be the Adapter type itself.