Represents the base class for UI components (page objects and controls).

When accessing any UIComponent’s and inherited type’s member that uses Scope (actual HTML element) property, executes TriggerEvents.BeforeAccess and TriggerEvents.AfterAccess triggers. Find out more on triggers.

Syntax

There are 2 UIComponent classes. The generic one is inherited from the non-generic:

public abstract class UIComponent

and

public abstract class UIComponent<TOwner> : UIComponent, IUIComponent<TOwner>
    where TOwner : PageObject<TOwner>

TOwner is the type of the owner page object. Declaring any control or page object requires specifying TOwner.

Properties

public IWebElement

Scope { get; }

Gets the IWebElement instance that represents the scope HTML element. Also executes TriggerEvents.BeforeAccess and TriggerEvents.AfterAccess triggers.

Component.Scope.SendKeys("some text");
public UIComponentAttributeProvider<TOwner>

Attributes { get; }

Gets the UIComponentAttributeProvider<TOwner> instance that provides an access to the scope element’s attributes.

Component.Attributes.Class.Should.Contain("some-class");
Component.Attributes["data-value"].Should.Equal("val");
public UIComponentCssProvider<TOwner>

Css { get; }

Gets the UIComponentCssProvider<TOwner> instance that provides an access to the scope element’s CSS properties.

Component.Css["display"].Should.Equal("block");
public DataProvider<bool, TOwner>

IsVisible { get; }

Gets the DataProvider<bool, TOwner> instance for the value indicating whether the control is visible.

Component.IsVisible.Should.BeTrue();
public DataProvider<string, TOwner>

Content { get; }

Gets the DataProvider<string, TOwner> instance for the text content.

Component.Content.Should.Contain("some value");
public UIComponentVerificationProvider<UIComponent<TOwner>, TOwner>

Should { get; }

Gets the verification provider that gives a set of verification extension methods.

Component.Should.Exist();
Component.Should.Not.BeHidden();
Component.Should.BeDisabled();
public UIComponentTriggerSet<TOwner>

Triggers { get; }

Gets the set of triggers. Provides the functionality to get/add/remove triggers dynamically.

Component.Triggers.Add(new WaitAttribute(2));
public UIComponentLocationProvider<TOwner>

ComponentLocation { get; }

Gets the UIComponentLocationProvider<TOwner> instance that provides an access to the scope element’s location (X and Y).

Component.ComponentLocation.X.Should.BeGreater(10);
public UIComponentSizeProvider<TOwner>

ComponentSize { get; }

Gets the UIComponentSizeProvider<TOwner> instance that provides an access to the scope element’s size (Width and Height).

Component.ComponentSize.Height.Should.BeLessOrEqual(15);

Methods

public IWebElement

GetScope(SearchOptions options = null)

Gets the IWebElement instance that represents the scope HTML element. Also executes TriggerEvents.BeforeAccess and TriggerEvents.AfterAccess triggers.

public bool

Exists(SearchOptions options = null)

Determines whether the component exists. If options is set to null, then it uses SearchOptions.Safely().

public bool

Missing(SearchOptions options = null)

Determines whether the component is missing. If options is set to null, then it uses SearchOptions.Safely().

public TOwner

Wait(Until until, WaitOptions options = null)

Waits until the specified component condition is met.

LoadingBlock.Wait(Until.Hidden);
// Or
ContentBlock.Wait(Until.Visible);