Search code examples
c#watin

Watin : Get DropDown list


I'm trying to get a list from a dropdown,since it's not a selectlist i've tried something like this

   this.ContextBrowser.Link(new Regex("ddlSQuestion1_Arrow")).Click();
   this.ContextBrowser.Div(Find.ByText(new Regex("What is the name of the first school you attended?"))).Click();

What the code is actually doing is clicking on the dropdown arrow, manage to pull down the list but i can;t click on the list aka li.How can i click on the dropdown list.Any suggestions?


Solution

  • Try to get the elements inside the dropdown list like so

    var select = this.ContextBrowser.Link(new Regex("ddlSQuestion1_Arrow")).Element[2];
    select.click();
    

    Hope this help