使用Selenium提取所有行?

时间:2016-12-13 14:44:10

标签: python python-2.7 selenium selenium-chromedriver

我必须从下面指定的网站中提取/抓取数据。我现在遇到的困境是该网站默认只显示1000行,即使我点击 导出到Excel ,它也只导出1000行而不是网站上列出了237,593行。如何让Python从网站中提取所有237,593条数据记录。如果 Selenium 是执行此任务的准确模块,请与我们联系。

from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options

driver = webdriver.Chrome("C:\Python27\Scripts\chromedriver.exe")
driver.get("https://etrakit.friscotexas.gov/Search/permit.aspx")

number_option = driver.find_element_by_id("cplMain_btnSearch")
number_option.click()

delay = 3 
try:
    WebDriverWait(driver, delay).until(EC.visibility_of_element_located((By.ID,"cplMain_btnExportToExcel")))
    print "Page is ready!"
except TimeoutException:
    print "Loading took too much time!"


search_button = driver.find_element_by_id("cplMain_btnExportToExcel")
search_button.click()


driver.close()
driver.quit()

print 'ALL DONE'

0 个答案:

没有答案