tags:

views:

489

answers:

2

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();
+1  A: 

You could check if IE is busy rather than complete.

while (((SHDocVw.InternetExplorerClass)(_ie.InternetExplorer)).Busy)
        {
            System.Threading.Thread.Sleep(2000);
        }
runrunraygun
It's sad that I can't mark two answers as correct but I will keep in mind your trick as well for future use
Sergej Andrejev
A: 

Hi Sergej,

WaitUntilComplete doesn't recognize ajax calls. See this article (search on WaitForAsyncPostBackToComplete) on how to inject some code to make that work as well: WatiN, Ajax and some Extension Methods

HTH, Jeroen

Jeroen van Menen
Thank you. That exactly what I found later on. It's strange how I didn't came around this article in first 3 days of searching
Sergej Andrejev