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  

  

posted on 2018-05-02 10:39  小白闯天下  阅读(219)  评论(0编辑  收藏  举报