I want to find all strings in a text with WatiN. I can find the first string, but i can't gather all of them. For example I want find all occurrences of "water" in this text:
There is a lot of water on earth. But not all water is drinkable.
So here I should find 2 "water". My code only finds the first one. How can I find both of them?
My code is:
IE ie = new IE("http://examplesite.com");
Element test = ie.Table(Find.ByClass("dataTable")).Element("td");
ie.TableRow(Find.ByText(t => t.Contains("example string"))).TextField(Find.ByName("examplename")).Button(Find.ByValue("example value")).Click();
ie.WaitForComplete();
Console.WriteLine("finished");
You can use IndexOf in a loop to find multiple occurrences of a substring.