vbs自動(dòng)填表單分析附源碼
更新時(shí)間:2008年06月19日 09:19:34 作者:
用vbs實(shí)現(xiàn)的自動(dòng)填寫表單的代碼分析,希望大家注意代碼的寫法
dim ie
set ie=createobject("internetexplorer.application")
ie.visible=true
ie.navigate "http://www.ln.chinaunicom.com/index.shtml"
While ie.busy or ie.readystate<>4
EndWhile
ie.document.all("userid").value= "13304948957"'手機(jī)號(hào)碼
ie.document.all("passwd").value = "111111"'密碼
ie.document.all("verifycode").value = "1111"'識(shí)別碼
ie.document.all.loginOnForm.submit
一調(diào)試腳本就顯示 缺少對(duì)象:"ie.document.all("....")"
"ie.document.all.loginOnForm.submit"這行還顯示對(duì)象不支持此屬性或者方法
請(qǐng)各位大俠幫忙看看 哪里出了錯(cuò) 謝謝啦
提問(wèn)者: fxdca2008 - 試用期 一級(jí)
最佳答案
樓主代碼有幾處錯(cuò)誤:
1. EndWhile應(yīng)為Wend
2. 網(wǎng)頁(yè)上的手機(jī)號(hào)碼、密碼等表單元域其實(shí)是在一個(gè)<iFrame>中的網(wǎng)頁(yè)上,不能直接調(diào)用,而應(yīng)該使
用ie.document.frames(0).document.loginOnForm...來(lái)調(diào)用
正確代碼如下(可以自動(dòng)填寫交提交,提交上去以后會(huì)返回“識(shí)別碼錯(cuò)誤”的提示,屬于正常現(xiàn)象)
:
Sub test()
Dim ie
Set ie = CreateObject("internetexplorer.application")
ie.Visible = True
ie.navigate "http://www.ln.chinaunicom.com/index.shtml"
While ie.busy Or ie.readystate <> 4
Wend
ie.document.frames(0).document.loginonform.UserId.Value = "13304948957" '手機(jī)號(hào)碼
ie.document.frames(0).document.loginonform.passwd.Value = "111111" '密碼
ie.document.frames(0).document.loginonform.verifycode.Value = "1111" '識(shí)別碼
ie.document.frames(0).document.loginonform.submit
End Sub
set ie=createobject("internetexplorer.application")
ie.visible=true
ie.navigate "http://www.ln.chinaunicom.com/index.shtml"
While ie.busy or ie.readystate<>4
EndWhile
ie.document.all("userid").value= "13304948957"'手機(jī)號(hào)碼
ie.document.all("passwd").value = "111111"'密碼
ie.document.all("verifycode").value = "1111"'識(shí)別碼
ie.document.all.loginOnForm.submit
一調(diào)試腳本就顯示 缺少對(duì)象:"ie.document.all("....")"
"ie.document.all.loginOnForm.submit"這行還顯示對(duì)象不支持此屬性或者方法
請(qǐng)各位大俠幫忙看看 哪里出了錯(cuò) 謝謝啦
提問(wèn)者: fxdca2008 - 試用期 一級(jí)
最佳答案
樓主代碼有幾處錯(cuò)誤:
1. EndWhile應(yīng)為Wend
2. 網(wǎng)頁(yè)上的手機(jī)號(hào)碼、密碼等表單元域其實(shí)是在一個(gè)<iFrame>中的網(wǎng)頁(yè)上,不能直接調(diào)用,而應(yīng)該使
用ie.document.frames(0).document.loginOnForm...來(lái)調(diào)用
正確代碼如下(可以自動(dòng)填寫交提交,提交上去以后會(huì)返回“識(shí)別碼錯(cuò)誤”的提示,屬于正常現(xiàn)象)
:
Sub test()
Dim ie
Set ie = CreateObject("internetexplorer.application")
ie.Visible = True
ie.navigate "http://www.ln.chinaunicom.com/index.shtml"
While ie.busy Or ie.readystate <> 4
Wend
ie.document.frames(0).document.loginonform.UserId.Value = "13304948957" '手機(jī)號(hào)碼
ie.document.frames(0).document.loginonform.passwd.Value = "111111" '密碼
ie.document.frames(0).document.loginonform.verifycode.Value = "1111" '識(shí)別碼
ie.document.frames(0).document.loginonform.submit
End Sub
相關(guān)文章
VBScript 算一算你從出生到現(xiàn)在共計(jì)多少天
VBScript 算一算你從出生到現(xiàn)在共計(jì)多少天,呵呵,努力奮斗吧2009-11-11iisweb.vbs iis網(wǎng)站管理腳本使用介紹
可以使用命令行腳本 iisweb.vbs(存儲(chǔ)在 systemroot\System32 中)在運(yùn)行帶有 IIS 6.0 的 Windows Server 2003 家族成員的本地或遠(yuǎn)程計(jì)算機(jī)上創(chuàng)建網(wǎng)站配置。該命令不創(chuàng)建或破壞內(nèi)容,而只是設(shè)置目錄結(jié)構(gòu)和某些 IIS 配置文件2014-07-07