Forum Discussion

Veroniquelu's avatar
Veroniquelu
Contributor
9 years ago
Solved

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

Hi All,    I ran into some issues today.    So assuming the object can be everywhere, it can also be on the next half of the screen and you can only see it when you scroll down. How do I find suc...
  • AlexKaras's avatar
    9 years ago

    Hi,

     

    To display the web element that is out of the visible web page borders you may use the ScrollIntoView() native web function.

    E.g.:

    oControl.ScrollIntoView(false)

  • Veroniquelu's avatar
    Veroniquelu
    9 years ago

    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 :)