Forum Discussion

vlscfc's avatar
vlscfc
New Contributor
9 years ago

VisibleOnScreen is True when web object is not clickable

I am using TestComplete 12, and some of my web tests are failing now due to the VisibleOnScreen property value being True when the web object (Panel or TextNode) is partially visible but not clickable and not able to set focus. This is happening in both Chrome and Firefox browsers, latest versions.

Is this a known issue to be fixed?  Previously, I could safely check VisibleOnScreen to determine if the web object could be clicked.

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    VisibleOnScreen is precisely that... it determines whether or not the object is visible on screen. I think you may have just lucked out in the past for using whether or not it is "Enabled".  Try the "Enabled" property to see if it's clickable.

    • vlscfc's avatar
      vlscfc
      New Contributor

      The objects are indeed Enabled, Visible and VisibleOnScreen, although only partially and cannot accept a focus when I manually do a roll-over.

       

      I was going by the TestComplete Documentation, which indicates in the Remarks it could be used for visible controls that accept mouse clicks:

       

      Remarks

        •The VisibleOnScreen property returns true, if a control or its part is on screen and can accept mouse clicks. For example, focused controls whose opacity is set to 0 are absolutely transparent (that is, invisible), but their VisibleOnScreen property will return true.

        •The VisibleOnScreen property is always false for disabled Silverlight controls.  

       

      After more investigation, this appears to only happen in Chrome and not FireFox, so I am wondering if perhaps it's an issue with Chrome or that TC extension?

       

      Thanks for trying to help me out, I am puzzled and haven't found a work-around yet for my web app.

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        Might have something to do with the TC extension. Unfortunately, I'm running TC 10.6 so I don't have the latest and greatest so I can't check that out for you. I know Chrome recently updated to version 51 so it's possible something MIGHT be out of date.

  • Manfred_F's avatar
    Manfred_F
    Regular Contributor

    With my TC V11, I 've encountered the same behaviour: .visileOnScreen gives me false positives, so it is not reliable and I can't use it. What I tried to do is to check whether a control is available for clicking, and whether a given Dialog is active.

     

     

    As a Workaround, and even as a real improvement, I now use the OnOverlappingWindow-Callback.

    As a result, my scripts can just click any control available, regardless whether the Dialog is on top or not. Background dialogs are activated automatically, Messageboxes are closed, thus simplifying Scripting.

     

    That's the way to do it:

    - implement the OnOverlappingWindow-Callback

    - lead all .Click/.ClickButton/.ClickItem etc. -Actions to a common clickHandling function.

    - In this function, set any additional context You may Need for the callback.

    - In the Callback, You evaluate the standard and additional context and e.g. activate the desired Dialog or Close disturbing messageboxes. Then Your set a result context.

    - Afterwards, in the clickHandling function, You check the result context and react and do logging.

     

    Really works fine!

     

     

    • vlscfc's avatar
      vlscfc
      New Contributor

      Thanks for this information, it is very helpful! 

      I believe I can use this in other situations which are fragile to make them more robust, such as a fixed banner bar which overlaps underlying links and ScrollIntoView cannot be relied on.

      I appreciate the detail, I should be able implement this based on your steps.

       

      Many thanks!