1、以下只適合IE、Firefox:
1 el=browserCore.findElement(By.xpath(xpath)); 2 javaScriptExecutor.executeScript("arguments[0].scrollIntoView();", el); 3 javaScriptExecutor.executeScript("arguments[0].scrollIntoView(true);", el); 4 pause(stepInterval);
2、以下IE、Firefox、Chrome都適用:
1 //將內嵌滾動條拉到頁面最底端,才能看到的元素 2 javaScriptExecutor.executeScript("document.getElementsByClassName('"+className+"')[0].scrollTop=100000"); 3 pause(stepInterval);
