title: WatiN: Unable to click an Element twice - "Could not find element" error
body: <p>I am running into an issue where I need to click on an element twice. The first time the element is clicked it expands a tree on the page, the second time closes the tree. There is no issue when clicking the element the first time.</p>
  
  <p>Here is the part of the HTML code I am working with: (The element I am clicking is the 'a' tag.)</p>
  
  <pre><code>&lt;div id="uasMainForm:uasTabs:0:agencyTree-d-rt-c" name="c"&gt;
      &lt;div title="" class="iceTreeRow" id="uasMainForm:uasTabs:0:agencyTree-d-4" name="nd"&gt;
          &lt;a id="uasMainForm:uasTabs:0:agencyTree:4" onclick="document.forms['uasMainForm']['uasMainForm:uasMainForm:uasTabs:0:agencyTree_idtn'].value='4';iceSubmitPartial( document.forms['uasMainForm'], this,event); return false;" onblur="setFocus('');" href="javascript:;"&gt;
  </code></pre>
  
  <p>The weird thing is, if I run the second click immediately after running the first it closes the tree perfectly, but if I break it up with a MessageBox or some other code it throws an error when trying to perform the second click.</p>
  
  <p>Here is code that works:</p>
  
  <pre><code>agency = ie.ElementOfType&lt;Div&gt;(Find.ByText(agencyName));
  agencyTab = agency.ElementWithTag("a", Find.ByIndex(0));
  agencyTab.Click();
  
  //MessageBox.Show("Hey!");
  agencyTab.Click();
  </code></pre>
  
  <p>Here is the code that does not work:</p>
  
  <pre><code>agency = ie.ElementOfType&lt;Div&gt;(Find.ByText(agencyName));
  agencyTab = agency.ElementWithTag("a", Find.ByIndex(0));
  agencyTab.Click();
  
  MessageBox.Show("Hey!");
  agencyTab.Click();
  </code></pre>
  
  <p>The above code throws the error: Could not find A element tag matching criteria: Index = 0</p>
  
  <p>I have also tried Find.ById instead of ByIndex with the same result. Can anyone shed some light on what could be causing this error when breaking up the two click events, but not when the click events happen back to back?</p>