Forum Discussion

rohanmehta123's avatar
rohanmehta123
New Contributor
11 years ago

Drag and Drop

Hi All, I am using TestComplete 9.30 with JScript.

I want to drag a file (present at D:\\ drive) to a screen of application under test...

Can you please help?

3 Replies

  • simon_glet's avatar
    simon_glet
    Regular Contributor
    Hi Rohan,



    When you don't know where to start, just record whatever you want to do and be inspired by the generated code !



    Checkout the menu Test->Record->Record Script.



    Sincerely

  • function getXPosition(object){


      return object.WindowToScreen(10, 10).X;


    }


     


    function getYPosition(object){


      return object.WindowToScreen(10, 10).Y;


    }


     


    function dragFromTo(fromObject, toObject){  


      var fromX = getXPosition(fromObject);


      var fromY = getYPosition(fromObject);


      


      var toX = getXPosition(toObject);


      var toY = getYPosition(toObject);


      


      fromObject.Drag(10,10, toX-fromX, toY-fromY);


    }