# How to automate scroll bar

**URL:** <https://forum.robotframework.org/t/how-to-automate-scroll-bar/6471>\
**Category:** Robot Framework\
**Created:** [14 November 2023 17:56 UTC](https://forum.robotframework.org/t/how-to-automate-scroll-bar/6471 "2023-11-14T17:56:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nkina\_Ramonyai](https://avatars.discourse-cdn.com/v4/letter/n/b782af/32.png) [@Nkina\_Ramonyai](https://forum.robotframework.org/u/Nkina_Ramonyai)\
**Post date:** [14 November 2023 17:56 UTC](https://forum.robotframework.org/t/how-to-automate-scroll-bar/6471/1 "2023-11-14T17:56:00Z")

</div>

I found a way to automate scroll bar:  
Here is my code block  
Choose an annual increase percentage ${locator} AND ${ycord} AND ${xcord}  
${x}= Get Horizontal Position ${locator}  
${y}= Get Vertical Position ${locator}  
${yaxis}= Evaluate ${y} - ${ycord}  
${xaxis}= Evaluate ${x} - ${xcord}  
Execute Javascript window.scrollTo(${xaxis}, ${yaxis})  
Drag And Drop By Offset ${locator} ${yaxis} ${xaxis}:

FYI: You are going to need to do trial and error for the **${ycord}** AND **${xcord}** values, as there is no standard/straight line way to get the values.

Here is the element I am trying to drag, hope this helps.  
 ![2023-11-14_14h50_41](https://europe1.discourse-cdn.com/flex005/uploads/robotframework1/original/2X/1/1efbc773344843c3c667e64e3714a2852d80b35e.png)
