Forum Discussion

ashishnagpal26's avatar
ashishnagpal26
Contributor
9 years ago

Clarification regarding Drag functionality for Objects

Environment : TestComplete 12 

 

I am facing a issue wherein when I run a keyword individually the drag operation drags from the centre of the object but when I run the same keyword in terms of a test  ( as in there are a few keywords above it performing some operation )  the drag point is from the left top of the object . Because of which when I perform the drag operation with certain horizontal pixel value it doesn't reach the required position . I have attached a snapshot as an example . 

 

can someone please help me out on this. 

11 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Can you show us a screenshot of the drag operation in your keyword test? That would help determine if there is a setting or operational parameter set wrong.

      • Colin_McCrae's avatar
        Colin_McCrae
        Community Hero

        I'm kind of guessing here, but I'm not sure about -1 as the Client X/Y co-ordinate?

         

        I use drag and drop. To determine where I need to click (I always want the centre point), I get the Width and Height of the object to be dragged and divide those by two. Which gives me the centre point. The objects being dragged by my script can be of various different sizes, so I have to calculate the click point myself. (Of course, I also have to calculate the destination point as well. But that's a slightly different matter.)

         

        I can't see how "-1" could be a valid value for this (as these co-ordinates represent a point within the object to be dragged so the top left corner should be 0,0). But it obviously allows it. But I'm not sure where -1,-1 will put the mouse pointer, and I didn't see anything in the Drag method documentation that tells you this either.

         

        Or possibly HKosova may be able to tell us what it's doing with the -1's you currently have in there?