编程语言
首页 > 编程语言> > java web自动化js控制滚动条

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

标签:web,scrollTo,java,executeScript,javascriptExecutor,js,滚动条,JavascriptExecutor,JS
来源: https://www.cnblogs.com/xl95/p/12869127.html