I'm using WatiN 2.0 Final, and I'm encountering the following problem. Here is my code:
TableRow row = DOM.TableRow(Find.ByClass("itemRow").And(Find.By("itemID", itemId)));
TableCell inputCell = row.OwnTableCells[0];
if(inputCell.RadioButtons.Count != 0) inputCell.RadioButtons[0].Checked = true;
else inputCell.CheckBoxes[0].Checked = true;
Occasionally, row.OwnTableCells[0] throws an IndexOutOfRangeException (callstack below). If I check row.OwnTableCells.Count, it is zero, even though it should not be. If I try to view row.OuterHtml when .Count==0, it hangs in the OuterHtml property getter (in Element.WaitUntilExistsOrNot or some similar location). If I add a call to WaitUntilComplete() before this code, WaitUntilComplete() runs very quickly (because it's already loaded and ready), but it still locks up when trying to retrieve the row's OuterHtml because it thinks it's not ready.
It fails about 30-40% of the time, although the HTML is the same. Also, this is happening within a modal HTML dialog window.
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at WatiN.Core.UtilityClasses.LazyList1.get_Item(Int32 index) in C:\Users\adam\Desktop\WatiN\source\src\Core\UtilityClasses\LazyList.cs:line 74
at WatiN.Core.UtilityClasses.LazyList
1.System.Collections.Generic.IList<T>.get_Item(Int32 index) in C:\Users\adam\Desktop\WatiN\source\src\Core\UtilityClasses\LazyList.cs:line 157
at WatiN.Core.BaseComponentCollection`2.get_Item(Int32 index) in C:\Users\adam\Desktop\WatiN\source\src\Core\BaseComponentCollection.cs:line 67
PS. I'm using Windows 7 and IE 8.