-2
我試圖從Link中獲取一些信息。我想要獲取的數據是公司名稱,電子郵件,電話號碼,位置並將其粘貼到Excel表格中。請建議一些fromework /一種方法來刮取數據並將其寫入xls。我知道xlwt是一個框架。如何從網頁中獲取數據並將其粘貼到excel中
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
import time
browser = webdriver.Firefox() # Get local session of firefox
# 0 wait until the pages are loaded
browser.implicitly_wait(3) # 3 secs should be enough. if not, increase it
browser.get("http://ae.bizdirlib.com/taxonomy/term/1493") # Load page
#links =[]
#link=browser.find_elements_by_class_name('term-listing-heading')
#links = browser.find_elements_by_css_selector("h2 > a")
#print link
#for link in links:
# link.send_keys(Keys.CONTROL + Keys.RETURN)
# link.send_keys(Keys.CONTROL + Keys.PAGE_UP)
# time.sleep(2)
# link.send_keys(Keys.CONTROL + 'w')