python 操作ie 登陆土豆再退出

# -*- coding: utf-8 -*-
#by:pako
#email:[email protected]
import win32com.client  
import time  
ie6=win32com.client.Dispatch("InternetExplorer.Application")  
ie6.Navigate("http://www.tudou.com/")  
ie6.Visible=1 
while ie6.Busy:  
  time.sleep(1)  
 
document=ie6.Document  
document.getElementById("email").value="username"  #tudou.com user name
document.getElementById("pwd").value="password"  #tudou.com user password
document.forms[1].submit()

time.sleep(4)
print 'have login'
document.getElementById("uInfo").getElementsByTagName("span")[0].firstChild.click()
print ' logout'

你可能感兴趣的:(python)