Control Collection

A ControlCollection can be used to select multiple controls using a single selector.

When to use

The collection can be useful in scenarios like:

  • A group of controls with similar characteristics.

  • Interactions that should be done on multiple elements.

How to use

Collection declaration on PageObject

    [Selector("CheckBox")]
    public ControlCollection<ICheckBox> checkBoxCollection { get; set; }

Usage in code

    foreach (var checkBox in MyPageObject.checkBoxCollection)
    {
        checkBox.Checked = true;
    }

The collection can be navegated with Linq, foreach or by using the.controls property.

To know the Best Practices using Control Collection, you can check this article.

Last updated