Trying to call the FindChild method or property of an object but it does not exist
- 2 years ago
I was able to achieve the drag functionality using the following function that was shared by someone else in the community.
function dragCalculatedDistance() {
startObject = Aliases.pageEmailAnalyticsGettingStarted.workspace_FirstEmail_Val
destinationObject = Aliases.pageEmailAnalyticsGettingStarted.FindElement("//li[contains(.,'My Private Folder')]")
var startPoint, targetPoint, dragX, dragY;
// Drag from the center of object A to the center of object B
// destinationObject.Click()startPoint = startObject.WindowToScreen(startObject.scrollWidth /2, startObject.scrollHeight /2);
targetPoint = destinationObject.WindowToScreen(destinationObject.scrollWidth/2, destinationObject.scrollHeight /2);dragX = targetPoint.X - startPoint.X+50;
dragY = targetPoint.Y - startPoint.Y-80;//Note the +50 and -80 is something I used to make sure the coordinates can adjust and move to the object correctly.
startObject.Drag(-1, -1, dragX, dragY);
}
Let me know if this helps.
- 2 years ago
The coding provided by tristaanogre will work fine when moving the object horizontally, on any screen size. It's best to use the function and pass in the parameters for column 1 (source) and column 2 (destination).
I only suggested Keyword Testing, as I wasn't sure whether the correct method should be Drag or Move. You'll have more control with scripting, so I suggest to stick with that 🙂
Another approach, depending on whether your web application is JavaScript, is to use removeChild() and appendChild(). For example,
Which moves the child object "img_w3slogo.gif" from parent 1 "div1" to parent 2 "div2".