I have this table
I have to scroll horizontally to click the button as shown below
This is the HTML code for this element
<div tabindex="-1" class="v-grid-scroller v-grid-scroller-horizontal" style="padding-bottom: 17px; height: 0px; width: 1036px; left: 0px; overflow-x: scroll;"><div style="height: 17px; width: 1566.09px;"></div></div>
Is there any way I can perform the horizontal scroll using WATIR?
Similar to scrolling vertically, you will need to use JavaScript to horizontally scroll the element. This is done by setting the scrollLeft
property:
# Get the element that has the overflow property
div = browser.div
# Scroll to a specific point
div.execute_script('arguments[0].scrollLeft = 100;', div)
# Scroll right a certain amount
div.execute_script('arguments[0].scrollLeft += 50;', div)