Ask a Question

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

SOLVED
Moulya_p
Occasional Contributor

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.

1 ACCEPTED SOLUTION

Accepted Solutions
tristaanogre
Community Hero

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

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.

myObject.Drag(100,200,100,-100)

 

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

 

myObject.Drag(0,0,100,-100)

 

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.

 

Suggestion:

 

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.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

View solution in original post

5 REPLIES 5
tristaanogre
Community Hero

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

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.  


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Moulya_p
Occasional Contributor

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

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
Community Hero

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

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.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Moulya_p
Occasional Contributor

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

I considered the ScreenLeft and ScreenTop properties as my x and y co-ordinates respectively. Then used the drag method to resize the panel. I am getting an error saying "There was an attempt to perform an action at a point, which is beyond the screen". Is there any other way to determine the x & y co-ordinates for my object? I don't know where I am going wrong in choosing the co-ordinates, as the method is very staightforward.

tristaanogre
Community Hero

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

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.

myObject.Drag(100,200,100,-100)

 

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

 

myObject.Drag(0,0,100,-100)

 

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.

 

Suggestion:

 

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.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

View solution in original post

cancel
Showing results for 
Search instead for 
Did you mean: