如何用autoit au3脚本定位弹出网页的某个输入框呢?
展开全部
要看你打开的是什么网页。因为没个网页定义的 输入框的ID是不同的。下面给你一串自动登录163邮箱和yahoo邮箱的vbs代码,两个网址的输入框的ID就不一样,所以要因网页而定;而输入框的ID是需要用浏览器打开该网址,然后邮件打开source选项,在里面可以查看各个ID,包括登录按钮的ID等。需要au3是可以直接改的,有问题可以追问,希望对你有帮助!
MailAutoLogin "Yahoo"
'引号内表示登录邮箱名字,"163"是163邮箱 "Yahoo"是雅虎邮箱
Function MailAutoLogin(Choose)
Dim URL1:URL1 = "http://mail.163.com/"
Dim URLy:URLy = "http://cn.mail.yahoo.com/"
Dim MailLable,PassWordLable,LoginBotten,MailID,PassWd
Set ie = CreateObject("InternetExplorer.Application")
ie.visible = True
If Choose = "163" Then
URL = URL1
MailID = "123456789" '163邮箱账号
PassWd = "123456789" '163邮箱密码
MailLable = "idInput"
PassWordLable = "pwdInput"
LoginBotten = "LoginBtn"
ElseIf Choose = "Yahoo" Then
URL = URLy
MailID = "123456789" 'Yahoo邮箱账号,注意:需要输入完整地址
PassWd = "123456789" 'Yahoo邮箱密码
MailLable = "emailinput"
PassWordLable = "passinput"
LoginBotten = "submit"
End If
ie.navigate URL
While ie.busy Or ie.readystate <> 4
Wend
if ie.document.getElementById(MailLable).value = MailID Then
Else
ie.document.getElementById(MailLable).value = ""
ie.document.getElementById(MailLable).value = MailID
End If
ie.document.getElementById(PassWordLable).value = PassWd
wscript.sleep 500
ie.document.getElementById(LoginBotten ).click
End Function
MailAutoLogin "Yahoo"
'引号内表示登录邮箱名字,"163"是163邮箱 "Yahoo"是雅虎邮箱
Function MailAutoLogin(Choose)
Dim URL1:URL1 = "http://mail.163.com/"
Dim URLy:URLy = "http://cn.mail.yahoo.com/"
Dim MailLable,PassWordLable,LoginBotten,MailID,PassWd
Set ie = CreateObject("InternetExplorer.Application")
ie.visible = True
If Choose = "163" Then
URL = URL1
MailID = "123456789" '163邮箱账号
PassWd = "123456789" '163邮箱密码
MailLable = "idInput"
PassWordLable = "pwdInput"
LoginBotten = "LoginBtn"
ElseIf Choose = "Yahoo" Then
URL = URLy
MailID = "123456789" 'Yahoo邮箱账号,注意:需要输入完整地址
PassWd = "123456789" 'Yahoo邮箱密码
MailLable = "emailinput"
PassWordLable = "passinput"
LoginBotten = "submit"
End If
ie.navigate URL
While ie.busy Or ie.readystate <> 4
Wend
if ie.document.getElementById(MailLable).value = MailID Then
Else
ie.document.getElementById(MailLable).value = ""
ie.document.getElementById(MailLable).value = MailID
End If
ie.document.getElementById(PassWordLable).value = PassWd
wscript.sleep 500
ie.document.getElementById(LoginBotten ).click
End Function
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询