You are using javascript, which scrolls the main window, if you want to scroll the element, you must first get the element by id, and then change its property scrollLeft:
JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript(
"document.getElementById('gvLocationHorizontalRail').scrollLeft += 250", "");
If you want to change the scroll bar that moves up and down, you must change the property scrollTop.
source
share