chowdary
chowdary

Reputation: 1

Method for Syncing Page Load in Coded Ui

I have used playback. wait(3000) in my Coded Ui Script, to wait until my website it loaded. Sometimes the script fails, if the website takes more time to load. Is there any other way to wait until page is loaded ?

Upvotes: 0

Views: 76

Answers (1)

Prageeth Saravanan
Prageeth Saravanan

Reputation: 1063

PlayBack.Wait() is simply a sleep statement, which would wait unconditionally for given number of time. For UI Sync you should consider using waitfor statements. Something like below,

// Set the playback to wait for all threads to finish  
Playback.PlaybackSettings.WaitForReadyLevel = WaitForReadyLevel.AllThreads;

// Wait till your control is read (Loaded)
browserWindow.WaitForControlReady();

// Reset the playback to wait only for the UI thread to finish  
Playback.PlaybackSettings.WaitForReadyLevel = WaitForReadyLevel.UIThreadOnly;  

Take a look at other wait statements as well to sync your app better.

Upvotes: 1

Related Questions