How to move scroll bars using Robot Framework- Selenium?

5,567 views
Skip to first unread message

Paolo Mondelo

unread,
Jun 24, 2014, 5:52:02 AM6/24/14
to robotframe...@googlegroups.com
Hi,

With the given code snippet of the scroll bar, how can i move the scroll bar in the following order/direction using robot framework - selenium?

<div id="horizontalscrollx" style="overflow-x: scroll; overflow-y: hidden; width: 100%; height: 18px;">
     <div style="width: 3100px;"/>



1) I want to move scroll bar from the order of A, B, C,D, and to E . Any idea on how I can move it? I tried using :

Execute Javascript  window.document.getElementById('horizontalscrollx').scrollLeft = window.document.getElementById(horizontalscrollx").scrollWidth/2;

And as a result, I was able to move the scroll bar to position "C". However, I was not able to move the scroll bar from "C" to  "D" and from "D" to "E". I tried using the keyword:
Execute Javascript  window.document.getElementById('horizontalscrollx').scrollLeft = window.document.getElementById(horizontalscrollx").scrollWidth/-2;
Execute Javascript  window.document.getElementById('horizontalscrollx').scrollLeft = window.document.getElementById(horizontalscrollx").scrollWidth/-24;
Execute Javascript  window.document.getElementById('horizontalscrollx').scrollLeft = window.document.getElementById(horizontalscrollx").scrollWidth/-32;
Execute Javascript  window.document.getElementById('horizontalscrollx').scrollLeft = window.document.getElementById(horizontalscrollx").scrollWidth/-64;


Please help me. 

Thank you!

Regards,
Paolo

NIKHIL RAJGARHIA

unread,
Nov 30, 2017, 2:15:25 AM11/30/17
to robotframework-users
Even I am facing the same problem. If it has been resolved by you, please post the solution.

Paolo Mondelo

unread,
Dec 6, 2017, 12:57:46 AM12/6/17
to robotframework-users
Hi Nikhil,

What I did is I maximized the browser first then I estimated the coordinates. After getting the coordinates i used this keyword :

   Execute JavaScript    window.scrollTo(${x_location},${y_location})

Cheers,
Paolo
Reply all
Reply to author
Forward
0 new messages