In WatiN how to wait until postback is complete

Sergej Andrejev picture Sergej Andrejev · Dec 30, 2009 · Viewed 9.7k times · Source

in WatiN how can I wait until postback is complete.

For example:

// Postback response modifies update panel elsewhere on page
browser.Text("id").TypeText("asd"); 

// WatiN doesn't wait until postback is completed (what code should I replace it with?).
browser.WaitUntilComplete();

Answer

gingerbreadboy picture gingerbreadboy · Dec 30, 2009

You could check if IE is busy rather than complete.

while (((SHDocVw.InternetExplorerClass)(_ie.InternetExplorer)).Busy)
        {
            System.Threading.Thread.Sleep(2000);
        }