Forum Discussion

Kanika's avatar
Kanika
Contributor
10 years ago
Solved

How to do scroll in a panel when object spy not able to identify scroll but only identify panel?

I am not able to identy scroll with object spy but I am able to identify panel in which scroll is placed. What all methods are there to scroll within a panel?

  • Hi!

     

    It's a bit strange that listobj.ClickItem(2) does not work for you. It seems that scrollIntoView in this case might be still scrolling when TestComplete is performing ClickItem which causes TC to miss. You can try to put a little delay between the calls (Delay(1000) for instance) and see if it helps.

     

    Another way to perform a scroll within a panel is to use its scrollLeft / scrollTop properties. See HTML DOM scrollTop Property. Be aware that you will be scrolling a content of the panel not the panel itself.

     

    Hope this helps,

    UnveN.

9 Replies

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi,

     

    It depends on the app you are testing. For web testing, you can use the scrollIntoView method, for instance.

    • pclarke's avatar
      pclarke
      Occasional Contributor

      I find using the following more reliable and accurate

      panelCtl00Scrollablepanel | MouseWheel  | -2, ... 

       

      Simulates a mouse wheel rotation. Delta indicates the distance the wheel is rotated (a positive value indicates that the wheel was rotated forward, away from the user; a negative value indicates that the wheel was rotated backward, toward the user).

       

      a minus figure scrolls down basically and a postive figure scrolls up. Increase the number to increase the distance scrolled.

      • Daksha's avatar
        Daksha
        Occasional Contributor

        Thanks pclarke.

         

        MouseWheel  worked for me.

         

        JScript snippet to scroll down by 3 position using mouse wheel is :

         

        Sys.Browser(*).Page(*).Panel(0).Panel(0).Form("collapse_form").Panel(0).MouseWheel(-3) ;

    • Kanika's avatar
      Kanika
      Contributor

      I tried using scrollIntoView method and able to scroll in panel but its not very convinient way to scroll.

      One challange I am facing in selecting list when I write below code:

       

      listobj.scrollIntoView(false)

      listobj.ClickItem(2)

       

      list not selecting but if I directly point to that list it selects 2nd object of list. I need to write script in such a way that I must scroll above first then select list. Please suggest.