def getCookie(self):
#获取cookie
spiderFirefox = webdriver.Firefox() spiderFirefox.get("http://www.cnvd.org.cn/") time.sleep(5)
cookies = ""
for cookie in spiderFirefox.get_cookies():
cookies += u"%s=%s; "%(cookie["name"], cookie["value"])
spiderFirefox.close()
return cookies