1. div内的ID定位及滚动
js = 'document.getElementById("zhizi_mask").scrollTop=10000'
driver.execute_script(js)
2. div内的classname定位及滚动,注意getElements返回的是个列表所以[0]
js = 'document.getElementsByClassName("scroll")[0].scrollTop=10000'
driver.execute_script(js)
3. 获取滚动条当前高度
get_scroll_height_js = "return document.documentElement.scrollTop"
4. 获取当前滚动条全部高度
more_h = 'var q=document.body.offsetHeight;return(q)'
参考:https://www.cnblogs.com/buchi-baicai/p/15910573.html
5. 一个新的类似selenium的工具playwright
参考:https://maimai.cn/article/detail?fid=1762379691&efid=rUjuIgz5_2WgjXR47GLyiA
标签:selenium,js,滚动条,scrollTop,div,document From: https://www.cnblogs.com/regit/p/17095165.html