Question: I am new at FluentValidation in general. I am writing a validator, and I can't seem to figure out how to do a .WithMessage with a WarningMessage instead of an ErrorMessage and use params.

I can do this:

```
RuleFor(x => x.Endorsement)
            .Must((coverage, endorsement) => HaveCoveragePerAcreOverMinimum(_coverage, coverage))
            .When(x => (!HaveSpecialRequest(_coverage) && !HavePermissionsToOverrideLimits()))
            .WithMessage("Some error message {0}", x => x.MyError);

```

But that sets it as an ErrorMessage and I need a Warning Message. I tried this but no dice:

```
RuleFor(x => x.Endorsement)
            .Must((coverage, endorsement) => HaveCoveragePerAcreOverMinimum(_coverage, coverage))
            .When(x => (!HaveSpecialRequest(_coverage) && !HavePermissionsToOverrideLimits()))
            .WithMessage(new WarningMessage("Some warning message {0}", x => x.MyError));

```

Answer: 
If you want to know how many matches there are, you need to get an element collection (not just an element). A collection is retrieved by pluralizing the element method - ie `as`.

```
b.as(:id => 'foo')
#=> <Watir::AnchorCollection>

```

From the collection, you can use `length` (or `count`) to find the number of instances:

```
b.as(:id => 'foo').length

```

Note that the element collection is Enumerable. This means you do not need to use a `while` loop and manual track the current index and total elements. For example, using `each`, you can simply write:

```
b.as(:id => 'foo').each do |a|
  puts a.text
end

```
Below code should work for you:

```
arr = Array.new
b.as(:id => 'foo').each { |a| arr.push a}

```