So I was using the most basic way in selenium/phantomjs to do the scroll down action. It seems to be all good in code, but doesn't work. I try to print "document.body.scrollHeight", after every scroll it stays the same. (e.g. height stays at 10532)
I'm browsing twitter page of a certain person like "twitter.com/XXXXX"
Can Any one give me a hint on what can I do here?
The webdriver I'm using is phantomjs
Here's the code:
def getfullpage(url):
print "getting fullpage..."
driver.get(url)
time.sleep(2)
reloads = 3000
pause = 0
driver.save_screenshot("what'shappening.jpg")
for times in range(reloads):
driver.execute_script("window.scrollTo(0,document.body.scrollHeight);")
time.sleep(pause)
newheight = driver.execute_script("return document.body.scrollHeight")
print newheight
page = driver.page_source.encode("utf-8","ignore")
return page