We are building a new experience for our SmartBear Community.
This site is now read-only. You can still browse and search as usual. Learn More

Forum Discussion

MulgraveTester's avatar
MulgraveTester
Frequent Contributor
8 years ago
Solved

How to avoid "Can't find window..." when testing if sys.desktop.activewindow.exists?

Hi,

Occasionally my code crashes when I test if sys.desktop.ActiveWindow.exists because "Cannot find the window with handle xxxxx".

The line immediately before the condition is sys.Refresh so I would have to be extremely unlucky for my object to be destroyed in the milliseconds since the refresh but it keeps happening.

Ho do I test this? Do I need to use isnull(sys.Desktop.ActiveWindow) instead?

  • I ended up using aqobject.issupported(myObj, "Exists") instead but thanks.

2 Replies

  • Marsha_R's avatar
    Marsha_R
    Icon for Champion Level 3 rankChampion Level 3

    Try using one of these Wait methods

     

    https://support.smartbear.com/testcomplete/docs/app-objects/common-tasks/waiting-process-or-window-activation.html

    • MulgraveTester's avatar
      MulgraveTester
      Frequent Contributor

      I ended up using aqobject.issupported(myObj, "Exists") instead but thanks.