赞
踩
import random
from selenium import webdriver
import time
def view(browser, blog):
browser.maximize_window()
browser.get(blog)
time.sleep(5)
urls = []
html_as = browser.find_elements_by_css_selector("li.blog-unit a")
for html_a in html_as:
urls.append(html_a.get_attribute("href"))
print urls
for html in urls:
try:
browser.get(html)
time.sleep(random.randint(3, 5))
except Exception, e:
print e
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。