Forum Discussion

joscva's avatar
joscva
Contributor
19 days ago

What to do when UI element can't be selected by TC in a Keyword test?

I need to close a window of our Desktop Application, but the close box is inaccessible to TestComplete.  Object Spy can't see it, it only sees the entire window.

I found that I can directly call the CloseWindow method (or just Close) and that prompts the window to close, but our application always asks the user if they are sure they wish to close the window via a simple yes/no popup dialog.  If I invoke closing via the method directly, then these yes/no buttons are not able to be interacted with at all by TC, despite TC being able to see them fine.

If I manually click the close box, then let TC interact with the Yes/No buttons, they work fine.  So it seems to me that something about invoking the method directly, is freezing TC out of being able to see that the Yes/No popup has appeared.

I'd be happy to get either scenario working - getting TC to click the close button of the window, or invoking the method directly and getting TC to interact with the confirmation dialog.  Any suggestions on how to deal with such a situation?  I looked through the Freezing Diagnostics and tried to get it to tell me something, but it never produced any messages of any kind.

 

  • Hassan_Ballan's avatar
    Hassan_Ballan
    Regular Contributor

    If TestComplete can interact with the Yes/No buttons perhaps finding the parent may be the window that TestComplete cannot interact with.

    Not sure I have any input on this and maybe you can work around it by simulations user keyboard keys rather then mouse clicks.

    • joscva's avatar
      joscva
      Contributor

      Funny you mention that - that was exactly the first alternative I tried, simply typing "Enter".  It also doesn't work... TC is just completely unable to do anything once the close method has been called.  It won't ever time out either, it will just sit forever, waiting for... something.

      • joscva's avatar
        joscva
        Contributor

        Got it!  Invoking the close method directly just wouldn't work, but manually typing Alt-F4 does invoke a window close in such a way, that the "yes" button is perfectly clickable without issue.  So I can't type text *after* this state has been entered, but as long as it's not entered in the first place, then all is fine.  I still don't understand why the direct method call wouldn't work, but at least I can move forward.