模擬登錄淘寶
Selenium+PhantomJS
from selenium import webdriver
driver = webdriver.PhantomJS()
driver.get(“https://login.taobao.com/member/login.jhtml“)
driver.find_element_by_id("TPL_username_1").clear()
driver.find_element_by_id("TPL_password_1").clear()
driver.find_element_by_id("TPL_username_1").send_keys(self.username)
driver.find_element_by_id("TPL_password_1").send_keys(self.password)
driver.find_element_by_id("J_SubmitStatic").click()
#driver.get_cookies()取得cookie
cookie = "; ".join([item["name"] + "=" + item["value"] +"\n" for item in driver.get_cookies()])
print cookie
#然后帶上cookie登錄后的頁面去請求頁面