views:

124

answers:

1

Using IE8's developer mode, I see that select lists are implemented using partial postbacks. Unfortunately, the select list itself doesn't appear addressable. It has no ID. Here is how it looks in IE8:

<TD id=ctl00$mainContentPlaceHolder$DashboardTabContainer$Documents$DocumentsGrid_pager class="ig_8862b396_r0 DataGrid ig_8862b396_r16 DataGridPager" onclick="igtbl_onPagerClick('ctl00xmainContentPlaceHolderxDashboardTabContainerxDocumentsxDocumentsGrid',event)" align=right>
    <SELECT onchange="javascript:igtbl_pageGrid(event,'ctl00xmainContentPlaceHolderxDashboardTabContainerxDocumentsxDocumentsGrid',(this.selectedIndex+1).toString())">
        <OPTION selected>1
        <OPTION>2
        <OPTION>3
        <OPTION>4
        <OPTION>5
        <OPTION>6
        <OPTION>7</OPTION>
    </SELECT>
</TD>

How do I address the select list here? Alternatively, using WatiN from C# and nunit, how do I send pagination events to the grid?

A: 

One answer (by far the least favored) was to address them by position. That is to say:

if (Browser.SelectLists.Count > 0)
    {
        Browser.SelectLists[0].Select(_rand.Next(1, Browser.SelectLists[0].Options.Count).ToString());
    }

if anyone finds a way to do this by ID instead of position, let me know.

Ry