Here i am adding simple code for Scroll down method.we can scroll down and up methods in a 3 ways....
Using JavaScriptExecutor:
JavascriptExecutor jsx = (JavascriptExecutor)driver;
jsx.executeScript("window.scrollBy(0,450)", "");
Using Actions Class
Actions action=new Actions(driver);
action.sendKeys(Keys.DOWN).perform();
action.sendKeys(Keys.DOWN).perform();
action.sendKeys(Keys.DOWN).perform();
action.sendKeys(Keys.DOWN).perform();
{OR}
Actions action=new Actions(driver);
action.keyDown(Keys.CONTROL).sendKeys(Keys.PAGE_DOWN).perform();
{OR}
With out Using Actions
Class
for(int i=0;i<20;i++)
{
driver.findElement(By.tagName("body")).sendKeys(Keys.DOWN);
}
Your javascript code solved it . Thanks !!!
ReplyDeleteHi Sivaprasad Kandula,
ReplyDeleteI think these methods would not work if there are multiple scroll-bars and each residing a in a different div sections which are not in an iframe.
Do you have any suggestions for those cases?
Thanks,
dl