Monday, February 21, 2011

using regular expression in watin

I'm using regular expression in watin.

I have something like: ie.Button(Find.ByName(new Regex(input))).Click(); but I wan't to click on the second or third button that match and not the first one.

How can I do this?

From stackoverflow
  • Try this:

    ie.Button(Find.ByName(new Regex(input)) && Find.ByIndex(1 /* or 2 */)).Click();
    
  • Try this:

        ButtonCollection buttonCol = ie.Buttons;
        buttonCol = buttonCol.Filter(Find.ByName(new Regex(input)));
        buttonCol[1].Click();
        buttonCol[2].Click();
    

0 comments:

Post a Comment