Forum Discussion

la2texas's avatar
Occasional Contributor
8 years ago

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

  • HKosova's avatar
    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).