user3651479 user3651479 - 10 months ago 52
CSS Question

Scroll not working in Internet Explorer

I tried scroll(x,y) using javascript in Internet Explorer 10 . But, it did not work when I tried executing the script for a website. What is the equivalent for the same in IE ? It's a part of a Java Selenium test. I need to scroll in the page. So, I do that by executing a javascript code by using javascript executor.

for(int i=0;i<X;i+=Y)
String cmd = "window.scrollTo(0,"+i+")";
((JavascriptExecutor) driver).executeScript(cmd);

I use the above code in my test to scroll the page. But, in Internet Explorer IE10 it doesn't work.


The correct syntax would be window.scrollTo(xpos,ypos). This works in all major browsers, read about the function here.