Ask a Question

How do you wait on a Window?

la2texas
Occasional Contributor

How do you wait on a Window?

For the web portion in test left, you can IWebPage.Wait, but there is no equivalent for an ITopLevelWindow. I'm trying out TestLeft to see if it fits our needs, and the first test is to test the login functionality. Enter username, password, click login and wait for the MainWindow to open. But the test runs through without waiting for the authentication call.

 

1 REPLY 1
HKosova
SmartBear Alumni (Retired)

Hi la2texas,

 

You can use TryFind to search and wait for objects:

// Wait for the Notepad window for 25 seconds
ITopLevelWindow wndNotepad; process.TryFind<ITopLevelWindow>(new WindowPattern() { WndClass = "Notepad" }, 1 /* depth */, 25000 /* ms timeout */, out wndNotepad);
if (wndNotepad != null)
{ // found
}

There are TryFind overloads with and without explicit timeout. If the timeout is not specified, the default timeout of 10 seconds is used (it is controlled by the Driver.Options.General.AutoWaitTimeout value).


Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
cancel
Showing results for 
Search instead for 
Did you mean: