python 操作ie 登陆土豆再退出
# -*- coding: utf-8 -*-#by:pako
#email:zealzpc@gmail.com
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.submit()
time.sleep(4)
print 'have login'
document.getElementById("uInfo").getElementsByTagName("span").firstChild.click()
print ' logout'
username 和password 自己注册个账号就可以试了,这里就不提供了.
页:
[1]