java web自动化js控制滚动条

1.JS滚动,将页面滚动条拖到底部   

JavascriptExecutor javascriptExecutor = (JavascriptExecutor)BrowserUtil.driver;

javascriptExecutor.executeScript("window.scrollTo(0,document.body.scrollHeight)");

 

2.JS滚动,将页面滚动条拖到指定位置

JavascriptExecutor javascriptExecutor = (JavascriptExecutor)BrowserUtil.driver;

javascriptExecutor.executeScript("window.scrollTo(0,document.body.scrollHeight*1/3)");

 

https://blog.csdn.net/dawei_yang000000/article/details/105540011

posted @ 2020-05-11 14:46  rfvtgb  阅读(584)  评论(0编辑  收藏  举报