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