Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get current scroll height in selenium python

I want to get current scroll height in selenium python Such as if i have scrolled in the middle of stack overflow, so i want the current scroll height in using selenium in python Thanks I have tried this

height =  browser.execute_script("return document.body.scrollHeight")
like image 905
Sahibzada Muhammad Avatar asked Sep 03 '26 23:09

Sahibzada Muhammad


1 Answers

Instead try this :

height = browser.execute_script("return document.documentElement.scrollHeight")
like image 172
Ehsan Avatar answered Sep 06 '26 13:09

Ehsan