python-selenium,关于页面滑动
第一种:
#滑到底部
js="var q=document.documentElement.scrollTop=100000"
driver.execut_script(js)
目前在firefox,chrome上验证都是可以跑通的
#滑动到顶部
js="var q=document.documentElement.scrollTop=0"
driver.execut_script(js)
第二种
#滑到底部
js="window.scrollTo(0,document.body.scrollHeight)"
driver.execute_script(js)
目前在firefox,chrome上验证都是可以跑通的
#滑动到顶部
js="window.scrollTo(0,0)"
driver.execute_script(js)
scrollHeight 获取对象的滚动高度。 
scrollLeft 设置或获取位于对象左边界和窗口中目前可见内容的最左端之间的距离。 
scrollTop 设置或获取位于对象最顶端和窗口中可见内容的最顶端之间的距离。 
scrollWidth 获取对象的滚动宽度。
 
                    
                     
                    
                 
                    
                
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号