Forum Discussion

Moulya_p's avatar
Occasional Contributor
6 years ago

How to resize an object of type Panel in the Web Page?

Hello Everyone,


I am working on a script where it requires me to change the size of a panel by dragging it in the web application. I have used the Drag method in order to resize my panel.

I have written the following where width and heigth are the properties for the particular object retreived by Object Spy- 

draggableObj.Drag(width, height, 20, 0)

It is not throwing any error, but also not changing the width of my object.


So could someone please suggest me how to go about this?


Thanks in advance.

  • ScreenLeft and ScreenTop are relative to the screen, not the object.

    So... let's take a different example to describe how drag works.

    Let's say I have an object that is 200 pixels by 400 pixels.  I want to click on the center of it and drag it 100 pixels up and 100 pixels right.

    SO, that looks like this.



    If I want to do the same, but do so by clicking on the upper left corner of my object, taht would be




    The first two co-ordinates are pixels RELATIVE to the dimensions of your actual object.

    So... you know height and width.  If you used those as the first two co-ordinates as you suggested in your original post, that would be having the automation click in the bottom right corner of your object and attempting to drag it.   What you need to do is figure out, based upon height and width and the location of your control point on your object to resize, what are the pixel co-ordinates on your object that you need in order to do the resize.




    Create a brand new keyword test... and simply record your drag action that does the resize.  That's all... just the drag action.  This will give you an insight as to what co-ordinates to use and you can then adjust from there.

5 Replies

  • tristaanogre's avatar
    Esteemed Contributor

    The first two parameters of the Drag action are the X/Y co-ordinates of where to click (mouse down)... the starting co-ordinates if you will.  The next two co-ordinates are the change in X and change in Y for the drag.


    So, the height and width of your object aren't the best values for the two properties.  You will need to determine where you "mouse down" to be able to drag to change the panel size.  

    • Moulya_p's avatar
      Occasional Contributor

      Thanks for the reply tristaanogre. In order to determine the co-ordinates for my "mouse down" action, should I consider the pixel values with respect to the page or is there any other particular properties which I can make use of?  

      • tristaanogre's avatar
        Esteemed Contributor

        Since Drag is a method on the object, the x/y is the co-ordinates on the object that you want to click on in order to drag.