Scroll Application UP & DOWN Until Element Visible
Scroll UP ::
Scroll UP ::
public void scrollup(String xValue)
{
String parameter="scroll(" +xValue+ ",0)";
JavascriptExecutor jse = (JavascriptExecutor)wdriver;
jse.executeScript(parameter); //xvalue '500' can be altered
}
Scroll Down ::
public void scrolldown(String num) {
JavascriptExecutor jse = (JavascriptExecutor) wdriver;
jse.executeScript("window.scrollBy(0,"+num+")", "");
}
Scroll Until Element Visible ::
public void scrollToElementViaJavascript(WebElement element)
{
((JavascriptExecutor) wdriver).executeScript("arguments[0].scrollIntoView();", element);
}
No comments:
Post a Comment