title: WatiN - Selecting a drop down menu from pop up
body: <p>I am currently trying to set up WatiN to do some automated testing of a new CRM solution.  We have a screen button called Advanced Find. <br>
  When this button is clicked, a new pop up opens.  This popup has a drop down menu and I would like to click it and select on option from it.</p>
  
  <p>The code for the pop up window is:</p>
  
  <pre><code>td class="ms-crm-AdvFind-Label"&gt;&lt;br&gt;
  td class="ms-crm-AdvFind-EntityList"&gt; &lt;br&gt;
  select name="slctPrimaryEntity" class="ms-crm-SelectBox " id="slctPrimaryEntity"     Sort="ascending" defaultSelected="activitypointer"&gt;&lt;br&gt;
  option title="Organisations" value="account"&gt;
  </code></pre>
  
  <p>The WatiN code I have is as follows:</p>
  
  <pre><code>ie.Image(Find.ByClass("ms-crm-ImageStrip-advancedfind32")).Click();
  IE poppedUpBrowser = IE.AttachTo&lt;IE&gt;(Find.ByTitle("Advanced Find - Microsoft Dynamics CRM"));
  SelectList ddl = poppedUpBrowser.SelectList(Find.ByClass("ms-crm-AdvFind-Label")&amp;(Find.ById("slctPrimaryEntity")));&lt;br&gt;
  ddl.Option("Organisations").Select();&lt;br&gt;
  Assert.That(ddl.SelectedItem.Equals("Organisations"));&lt;br&gt;
  </code></pre>
  
  <p>Can someone please point out where I have gone wrong.</p>
  
  <p>Thanks.</p>
  
  <p>Edit:</p>
  
  <p>I am currently getting this error message when running the test:</p>
  
  <pre><code>Failure: WatiN.Core.Exceptions.ElementNotFoundException : Could not find OPTION element tag matching criteria: Attribute 'innertext' equals 'Organisations' ignoring case at http://website
  
  Stack Trace:
  at WatiN.Core.Element.get_NativeElement()
  at WatiN.Core.Element.GetAttributeValueImpl(String attributeName)
  at WatiN.Core.Component.GetAttributeValue(String attributeName)
  at WatiN.Core.Option.setSelected(Boolean value, Boolean WaitForComplete)
  at WatiN.Core.Option.Select()
  </code></pre>
  
  <p>Edit: More HTML code:</p>
  
  <pre><code>&lt;tbody&gt;
  &lt;tr height="100%"&gt;
  &lt;td class="AdvFind_td_FindBody"&gt;
  &lt;span id="advancedFind"&gt;
  &lt;table class="ms-crm-AdvFindControl" id="advFind" cellSpacing="0" cellPadding="0" EntityName="activitypointer" UIProvider="" DataProvider="" EntityTypeCode="4200" DisableValueControlInSimpleMode="0" DistinctFetch="1" SaveChangesAlert="1" IncludeUserQuery="1" IncludeSystemQuery="1" ValidQueryType="0" FilterControlVisible="1" TitleVisible="0" EntityListVisible="1" RelatedEntitiesVisible="1" QueryListVisible="1" CanCreateUserQuery="1" CanWriteUserQuery="1" IncludeAPIQuery="0" FetchMode="2" Buttons="1023" Modes="3" Mode="1" aliasesInInitialFetch=""&gt;
  &lt;tbody&gt;
  &lt;tr class="ms-crm-AdvFind-TitleArea"&gt;
  &lt;td&gt;
  &lt;table class="ms-crm-AdvFind-Title-table" style="table-layout: fixed;"&gt;
  &lt;tbody&gt;
  &lt;tr&gt;
  &lt;td&gt;
  &lt;table&gt;
  &lt;tbody&gt;
  &lt;tr&gt;
  &lt;td class="ms-crm-AdvFind-EntityList"&gt;
  &lt;select name="slctPrimaryEntity" class="ms-crm-SelectBox " id="slctPrimaryEntity" Sort="ascending" defaultSelected="activitypointer"&gt;
  &lt;option title="Activities" value="activitypointer"&gt;
  &lt;option title="Addresses" value="customeraddress"&gt;
  </code></pre>