selenium动态下拉到底部

selenium动态下拉到底部,实现获取动态加载的数据.

# -*- coding: utf-8 -*-
# Create your views here.
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time

# Login 163 email
driver = webdriver.Firefox()
driver.get("https://www.taobao.com/")


print driver.title
driver.execute_script("window.scrollBy(0,3000)")
time.sleep(2)

driver.execute_script("window.scrollBy(0,5000)")
time.sleep(2)

driver.execute_script("window.scrollBy(0,15000)")
time.sleep(2)

driver.close()