Ho do I select the first item in a SelectList in WatiN? Below you can see how I have my selectlist declared and below that is how I’m attempting to call the select. I don’t see any options for index. Will I need to get a string collection of selected items and select by the [1] string or is there a simpler way to do this?
Page Class:
[FindBy(Id = "VariationRelationshipId")]
public SelectList VariationRelationship { get; set; }
Test Class:
//need to select 1st item in list
Browser.Page<MyPage>().VariationRelationship........
You need to be calling against an instance of a browser, not the
Watin.Core.BrowserclassTest code.
Class
Above checked on Watin2.1, IE9, Win7 – runs like a champ. Selects “conneticut” in the first select list on the page.