Forum Discussion

micsea64's avatar
micsea64
New Contributor
4 years ago
Solved

TestComplete failing to detect the overlapping window that is on the screen

I need to interact with an Overlapping Window in a Silverlight application.  Which I believe means that the window is considered a borderless window.  Test Complete is also able to detect the buttons on the window that I need to interact with, as Exists or as Visible.  The problem is that when I try to click on the button, I get a popup saying that Test Complete is waiting on the overlapping Window to become visible.  

 

From what I can tell, it is, and I have already found the UIAObject that is actively on the screen that I need to interact with, but TestComplete will tell me that it is waiting for the overlapping screen to become visible. 

 

While diving through Object Browser, I found that this particular window only exists within the Tree while it is on the screen.  So if I found that the object does exists, and that the button on that screen itself exists, I am not certain which window TestComplete believes it's waiting for. 

 

The worst part of all of this is, that it fails probably about 60% of the times I run it.  For sometime I thought it was a timing issue, so I put a 2 second delay in, but that didn't really change the success/failure rate.  I went diving through community posts, but I haven't been able to locate anything similar to what I am seeing.

 

I am paste the code below.  I get the 'Waiting on the overlapping window to become visible' message for TestComplete at the btnLogYes.Click() line.  After it has already detected that the logWindow exists, otherwise it skips over the button press, because if the logWindow doesn't exist, the Yes Button doesn't exist either.   I am also attaching the screen shot of my Overlapping Windows parameters in Playback. 

 

I suspect that this is going to be some form of weird Memory issue with SilverLight...

 

Any help would be greatly appreciated!

 

Log.Message("Pressing the Log Button");
global.commsLog.click();

Delay(2000);

Log.Message("Looking if the Log Window 'Yes' button is on the screen");
var parent = NameMapping.Sys.sllauncher.wndMyAvail.ShellEmbedding.ShellDocObjectView.browser.Silverlight_Control.Initializing_Application
var logWindow = parent.FindChild("ObjectIdentifier", "RadBusyIndicator");
var btnLogYes = logWindow.FindChild("ObjectIdentifier", "Yes", 0, true);

// Finish Logging the message
Log.Message("Pressing the Yes Button to finish logging the messages");
if (logWindow.Exists)
{
Log.Message("The Yes Log Button was visible, Click it!");
btnLogYes.Click();

}
else
{
Log.Message("The Yes Log Button was not visible");
}

 

 

  • Thanks for the suggestions!  I was able to get the necessary functionality working, unfortunately through different means then suggested.  Prior to making the post I had tried checking to ignore overlapping windows, which made the problem worse, since the window I was trying to check was an expected overlapping window.   I did not actually try to set the focus of Test Complete to the button on the page, since we had found a different solution.  However, I will keep this in mind moving forward.  

     

    What we did do to solve the problem, was to create a function within Test Complete to wait for the object to refresh through the tree. It essentially starts from the parent object, and searches for the object again in the tree, while looking for the parameters I am expecting to be True, such as Exists, or VisibleOnScreen, and it will wait a pre-defined time at maximum, until it finds the object I am trying to interact with. It seems to work everytime!   

     

    Marsha, Alex, Thank you for the suggestions!  I will definitly keep them in mind moving forward with TestComplete, and very glad to see that I had at least gotten a response from a post!  

5 Replies

  • Marsha_R's avatar
    Marsha_R
    Champion Level 3

    A couple of things to try:

     

    1)  Click the "ignore overlapping window" button in the settings and see what happens

    2) After you've checked for the window.exists, also check for button.exists to force TC to see it or not

    • AlexKaras's avatar
      AlexKaras
      Champion Level 3

      Hi,

       

      I did not work with Silverlight so this is just a guess (that worked with other technologies):

      instead of clicking the button try to focus it and press from keyboard.

      For example, instead of

      btnLogYes.Click();

      try this:

      btnLogYes.Focus();

      btnLogYes.Keys(" "); // space between quotes to emulate the press of the Space key

      // or btnLogYes.Keys("[Enter]");

       

      • sonya_m's avatar
        sonya_m
        SmartBear Alumni (Retired)

        Thank you Marsha and Alex.

         

        Hi micsea64 , which of the suggestions helped?🙂