使用body操作
# -*- coding:UTF- -*- import win32com.client from time import sleep second=win32com.client.DispatchEx("InternetExplorer.Application") second.Navigate('http://passport.cnblogs.com/login.aspx') second.Visible= while second.Busy: sleep() doc=second.Document body=doc.body #doc.getElementById("login") for i in body.getElementsByTagName("input"): if i.id=='input1': i.value=' if i.id=='input2': i.value='59459540a' for i in body.getElementsByTagName("input"): if i.id=='signin': i.click() print('click')