Forum Discussion

Jcorwin's avatar
Jcorwin
Occasional Contributor
9 years ago

Look for reliable method to bring objects in to view

I'm having an issue with a web form which is somewhat long.  It seems to be very difficult to scroll object in to view reliably.  A portion of the form is fine (top)...when I have to go below that, Test complete auto scrolls too far (ScrollInToView).  In this case the scrollbar is nonstandard (angular JS) so it is not accessible like standard scrollbars.  Anyone have a snippet of code they have used which works reliably? I have tried a couple solutions which haven’t worked out very well i.e.:

Do while not Obj.visible

   Page. Keys(Tab)

  •       Unreliable

   Click in currently exposed field then mouse wheel down

  •     Unreliable

 

Test complete does try to find the field on its own but seems to over scroll each time

2 Replies

  • Hi Jcorwin,

     

     

    That reminds me of problem I've faced recently. In my case, used the setFocus method on my "not visible in the page component" and than I got the arrow up and down.

     

    Something like

     

    myNotVisibleObject.setFocus();

    myNotVisibleObject.Keys("[Up]");

    myNotVisibleObject.Keys("[Down]");

     

    or even

     

    myNotVisibleObject.setFocus();

    Sys.Keys("[Up]");

    Sys.Keys("[Down]");

     

    Let me know if that helps.

     

    Regards,

     

    Leandro de Araújo Souza

    • lsprague3's avatar
      lsprague3
      New Contributor

      Thanks so much! this fixed a compatibility issue between browsers for a test. focus() worked wonders.