Forum Discussion

fayrehouse's avatar
fayrehouse
Frequent Contributor
12 years ago

Region Checkpoint - a TC Bug?!

Hi All,



Can anyone explain this behaviour if it's not a bug - and suggest a solution?



I have a region checkpoint defined, based on an object on my web page. 



1. If the object exists in the page, and is visible - the checkpoint passes (as you'd hope!)

2. If the object exists in the page, but is currently completely outside of the browser window, then TC automatically scrolls the browser up/down as required, until the object is 100% "in view" - and the checkpoint passes (again, as you'd hope)

3. If the object exists in the page, but is only partially visible currently - TC does NOT try scrolling the browser up/down to see if the rest of the object is there as expected - but instead, FAILS the checkpoint - even though the object IS there correctly.



Has anyone else experienced this? Suggested solutions (other than a script loop that scrolls the page repeatedly, trying to check for the object "manually"!)



BTW, we're running 9.31...



Cheers



Steve

  • Hi Steve,


     


    I would say that this behavior is expected. Even if the object is partially visible on the screen, most probably, its Visible property will be True. So, TestComplete thinks that the whole object is visible.


    As far as I understand, you are testing a web page. In this case, you can try using the ScrollIntoView function to scroll the page to the needed object and use it in the checkpoint after that.

  • fayrehouse's avatar
    fayrehouse
    Frequent Contributor
    Hi Tanya,



    ScrollIntoView does indeed provide a workaround - but in order to be "safe" here, I'd also need to do a check for object existance?



    Ie 



      if (Sys.Browser().Page("http://something").Form("abc").Image("xyz").Exists)

      {

         Sys.Browser().Page("http://something").Form("abc").Image("xyz").ScrollIntoView()

         Regions.RegionName.Check(Sys.Browser().Page("http://something").Form("abc").Picture()

      }



    Also, this only works for specific OBJECT regions. Regions defined against a "clipping" of a web page (eg, to show various object alignment or some such)  could not use this technique.



    I guess another workaround is to use PagePicture? ie, scroll to study the whole current page, hunting down the region? eg



        Regions.RegionName.PageCheck(Sys.Browser().Page("http://something").PagePicture()







    However, this in turn seems to have issues, owing to another post of mine! http://smartbear.com/forums/f81/fp2/t83878/problems-with-pagepicture/