我在Internet Explorer 10上使用JavaScript尝试使用scroll(x,y)。但是,当我尝试在网站上执行脚本时,它没有起作用。在IE中,有什么等效的方法吗?这是Java Selenium测试的一部分。我需要在页面中滚动。因此,我通过使用JavaScript执行器执行JavaScript代码来实现。
for(int i=0;i<X;i+=Y)
String cmd = "window.scrollTo(0,"+i+")";
((JavascriptExecutor) driver).executeScript(cmd);
我在测试中使用上述代码来滚动页面。但是,在Internet Explorer IE10中它不起作用。