Represents the hierarchical control (a control containing structured hierarchy of controls of TItem type). Default search finds the first occurring element.

Inherited from Control.

Syntax

[FindSettings(OuterXPath = "./", TargetName = nameof(Children))]
public class HierarchicalControl<TItem, TOwner> : Control<TOwner>
    where TItem : HierarchicalItem<TItem, TOwner>
    where TOwner : PageObject<TOwner>

Properties

public ControlList<TItem, TOwner>

Children { get; }

Gets the children ControlList<TItem, TOwner> instance.

Control.Children.Count.Should.Equal(5);
public ControlList<TItem, TOwner>

Descendants { get; }

Gets the descendants (all items at any level of hierarchy) ControlList<TItem, TOwner> instance.

Control.Descendants[x => x.Name == "Item 2.2"].Click();

Indexers

public TItem this

[int index] { get; }

Gets the child item at the specified index.

Control[0].Should.Exist();
Control[1].Name.Should.Equal("Item 2");
public TItem this

[Expression<Func<TItem, bool>> predicateExpression] { get; }

Gets the child item that matches the conditions defined by the specified predicate expression.

Control[x => x.Name == "Item 1"].Should.Exist();