Search code examples
c#regexwatin

WatiN cannot find an element by Regex


I have a span on page with the text "Details for item 1 bla-bla-bla". This code works OK:

IE.Span(Find.ByText(new Regex("Details for item 1"))).Click();

But this ('I' in upper case) - element not found:

IE.Span(Find.ByText(new Regex("Details for Item 1"))).Click();

Why? Did I miss something?


Solution

  • add (?i) to make it case insensitive

    new Regex("(?i)Details for Item 1 bla-bla-bla")