cancel
Showing results for 
Search instead for 
Did you mean: 

How do I find an Object if there's scroll bar involved? And how to Drag and Drop them?

SOLVED
Highlighted
Contributor

Re: How do I find an Object if there's scroll bar involved? And how to Drag and Drop them?

So in order to achive that, I replaced .Drag, Please see the code below:

function DragToObject(source, destination)
{
sDelay = 1000;
source.ScrollIntoView(false);
var point1 = source.WindowToScreen(source.Width/2, source.Height/2);
LLPlayer.MouseDown(MK_LBUTTON, point1.X, point1.Y, sDelay);

destination.ScrollIntoView(false);
var point2 = destination.WindowToScreen(destination.Width/2, destination.Height/2);
LLPlayer.MouseMove(point2.X, point2.Y, sDelay);
LLPlayer.MouseUp(MK_LBUTTON, point2.X, point2.Y, sDelay);

}

 

 

This works for me. Thank you all for being so nice and kind 🙂

View solution in original post

Highlighted
Community Hero

Re: How do I find an Object if there's scroll bar involved? And how to Drag and Drop them?

I would say 'Wow!' and thank you for sharing your finding 🙂

It is really good to know that LLPlayer and .ScrollIntoView can be used together and work as expected. Nice and useful trick.

 

To Support: Don't you think that this is worth to be mentioned in the 'TestComplete How To' ?

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
Highlighted
Community Hero

Re: How do I find an Object if there's scroll bar involved? And how to Drag and Drop them?

"To Support: Don't you think that this is worth to be mentioned in the 'TestComplete How To' ?"

 

+1 agreed!!!

 

Scrolling and drag'n'drop are two of the most common causes of problems and questions on here .....

Highlighted
Contributor

Re: How do I find an Object if there's scroll bar involved? And how to Drag and Drop them?

I am using angular based application and for me i tried simple method and it worked

 

e.g. (In Python+ TestComplete)

 

devModel = AllDevicesPageObject.devModelHeader(page);
devModel.Click();
devModel.scrollIntoView(True);
devModel.MouseWheel(8,skNoShift);

New Here?
Join us and watch the welcome video:
Announcements
Script Wanted
Let's start July with new challenges!

Create a script to pass custom command-line arguments as a test parameter for the TechCorner tag!

Will you dare to take the challenge?


Top Kudoed Authors