Hi @Guanhua_Jing,
I have used below code for scroll in my application. When a click to element does not happen, when element is not visible,an exception occurs using this I added this code. Hope this helps you.
js = (JavascriptExecutor) driver;
js.executeScript("window.scrollTo(0,0)");
do
{
try
{
driver.findElement(By.xpath().click();
break;
}
catch(Exception e)
{
js = (JavascriptExecutor) driver;
js.executeScript("window.scrollBy(0, 200)");}
} while(true);
Thanks,
Sujata