Forum Discussion

Raymondtailor's avatar
Occasional Contributor
2 years ago

How to scroll to a particular co-ordinate in Test Complete

I have spied a notepad and text box of a notepad contains a string which will be visible only if you scroll down.

Now I am trying to perform a single click there via passing a rectangle co-ordinate to the Test Complete.So with that it is able to click if it is visible on the screen otherwise it fails saying :"there was an attempt to perform an action at a point which is beyond the screen"

Is there any way where we can scroll to the point of interaction before performing the action.

I tried with following steps to achieve that but its of no help. official website

testObject.MouseWheelScroll(an integer value)


2 Replies

  • rraghvani's avatar
    Champion Level 3

    Are you not able to use the cursor keys, to scroll to the desired position?


    Can you provide screen shot examples as to what exactly you are trying to do?

  • Kitt's avatar
    Regular Contributor

    You can try using the scroll bar to bring the object into view (would work similarly to the web method scrollIntoView()) . Here's an example of how you could obtain the scroll bar's min, max and current position then move up/down/left/right as you wish to find the object. I would recommend using doing a quick record and playback test to see how TestComplete is finding the object and if screen coordinates are used (EX: testObject.Click(Xaxis, Yaxis)).



    function Main()
      var p, w, ScrollBar, Slider;
      // Obtain the scroll bar object
      p = Sys.Process("MyApp");
      w = p.Window("TForm1");
      ScrollBar = w.Window("TScrollBar");
      // Obtain the scroll box's positions and post them to the log
      Log.Message("Minimum Position: " + ScrollBar.wMin);
      Log.Message("Current Position: " + ScrollBar.wPosition);
      Log.Message("Maximum Position: " + ScrollBar.wMax);
      // Move the slider to the left
      // Increase the slider position
      Slider = ScrollBar.wPosition + 4;
      ScrollBar.wPosition = Slider;


    [Position reference] and [Scroll reference] 


    You can also try MouseUp and MouseDown instead of click:

    Unlike ClickClickMClickRDblClickDblClickM and DblClickR, the MouseDown method does not interact with the tested application. This makes the method useful for testing specific ActiveX controls.

    To release the mouse button, use the MouseUp method.

    [Mouse reference]