Forum Discussion

Kostja's avatar
Kostja
Contributor
9 years ago
Solved

Drag'n'Drop into invisible object

Hey guys,

 

im still a newbie to TestComplete and got a new problem. This time i want to drag'n'drop a widget into an object, which only appears when i start to drag otherwise its neither visible nor active. When I work with direct coordinates then everything is fine, but the test is meant to be excuteable for each resolution and as soon as i change the resolution the test fails. So i searched the board for some alternatives and found this --> http://community.smartbear.com/t5/Functional-Web-Testing/Drag-and-Drop-without-using-cordinate-system/m-p/87352#M20863

 

Unfortuantely this solution didn't help. When I execute this script -->

 

function DragNDrop()
{
  var panel;
  var panel2;
  var droppable;
  
  dashboard = Aliases.browser.pageAltivarLogin.panelDashboard;
  panel = Aliases.browser.pageAltivarLogin.panelWidgetmenu;
  panel.panelMenuopenerUiStateWhiteout.Click();
  panel.panelWidgetmenuitemUiDraggable.HoverMouse();
  panel2 = panel.panelWidgetmenuitemUiDraggableHo;
  droppable = dashboard.panelCol1.panelColumnUiSortable.panelColaddspaceUiDroppable;  
  dragX =  panel2.Left + panel2.Width /2;
  dragY =  panel2.Top + panel2.Height/2;
  dropX =  droppable.Left - panel2.Left + droppable.Width/2;
  dropY =  droppable.Top - panel2.Top + droppable.Height/2;
  panel2.HoverMouse();
  panel2.Drag(dragX, dragY, dropX, dropY);
  panel.panelMenuopenerUiStateWhiteout.Click();
}

...the test shows 'Waiting until the window is activated' and then finishes with an error.

 

Now my question is how can i define the place where the widget should be dragged to without using exact coordinates.

 

Thanks for help

  • Hey guys,

     

    so I figured out, what the problem is (had to pay more effort in search). Its because of the <div> element --> http://support.smartbear.com/viewarticle/56466/#Remarks

     

    Is there still a way to perform the drag action from the modal window to the main window since the <div>-element is not supported?

     

    PS: But still i wonder why does this code work... -->

     

    function DragNDrop()
    {
      var panel;
      var panel2;
      panel = Aliases.browser.pageAltivarLogin.panelWidgetmenu;
      panel.panelMenuopenerUiStateWhiteout.Click();
      panel.panelWidgetmenuitemUiDraggable.HoverMouse();
      panel2 = panel.panelWidgetmenuitemUiDraggableHo;
      panel2.Drag(103, 27, -970, -390);
      panel.panelMenuopenerUiStateWhiteout.Click();
    }

     

    ...and the other one doesn't?

     

    Thanks for help in advance

1 Reply

  • Hey guys,

     

    so I figured out, what the problem is (had to pay more effort in search). Its because of the <div> element --> http://support.smartbear.com/viewarticle/56466/#Remarks

     

    Is there still a way to perform the drag action from the modal window to the main window since the <div>-element is not supported?

     

    PS: But still i wonder why does this code work... -->

     

    function DragNDrop()
    {
      var panel;
      var panel2;
      panel = Aliases.browser.pageAltivarLogin.panelWidgetmenu;
      panel.panelMenuopenerUiStateWhiteout.Click();
      panel.panelWidgetmenuitemUiDraggable.HoverMouse();
      panel2 = panel.panelWidgetmenuitemUiDraggableHo;
      panel2.Drag(103, 27, -970, -390);
      panel.panelMenuopenerUiStateWhiteout.Click();
    }

     

    ...and the other one doesn't?

     

    Thanks for help in advance