CodedUI Visual Studio: How to wait for browser load

user3509125 picture user3509125 · Apr 9, 2014 · Viewed 7.5k times · Source

I was wondering if anyone new how to make the Automation Script in CodedUI wait for the web page to load before continuing on with the script.

So I fill out a form and press the "Continue" button, then the script times out because it gives up waiting. I realise I could use Playback.wait but then I would have code this each time I click continue.... and I have hundreds of scripts! Something similar to Seleniums WaitforBrowserLoad but for CodedUI

C# CodedUI in VS 2012

Any help would be appreciated.

Answer

Daniel Mann picture Daniel Mann · Apr 9, 2014

In my experience, Coded UI is excellent about waiting for page loads to be complete before continuing test execution. That said, you can force a wait for a specific control to exist with WaitForControlExist method. This method is a member of the base class of all UI controls, UITestControl.