vbs自動填表單分析附源碼
更新時間:2008年06月19日 09:19:34 作者:
用vbs實現(xiàn)的自動填寫表單的代碼分析,希望大家注意代碼的寫法
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ī)號碼
ie.document.all("passwd").value = "111111"'密碼
ie.document.all("verifycode").value = "1111"'識別碼
ie.document.all.loginOnForm.submit
一調(diào)試腳本就顯示 缺少對象:"ie.document.all("....")"
"ie.document.all.loginOnForm.submit"這行還顯示對象不支持此屬性或者方法
請各位大俠幫忙看看 哪里出了錯 謝謝啦
提問者: fxdca2008 - 試用期 一級
最佳答案
樓主代碼有幾處錯誤:
1. EndWhile應(yīng)為Wend
2. 網(wǎng)頁上的手機(jī)號碼、密碼等表單元域其實是在一個<iFrame>中的網(wǎng)頁上,不能直接調(diào)用,而應(yīng)該使
用ie.document.frames(0).document.loginOnForm...來調(diào)用
正確代碼如下(可以自動填寫交提交,提交上去以后會返回“識別碼錯誤”的提示,屬于正?,F(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ī)號碼
ie.document.frames(0).document.loginonform.passwd.Value = "111111" '密碼
ie.document.frames(0).document.loginonform.verifycode.Value = "1111" '識別碼
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ī)號碼
ie.document.all("passwd").value = "111111"'密碼
ie.document.all("verifycode").value = "1111"'識別碼
ie.document.all.loginOnForm.submit
一調(diào)試腳本就顯示 缺少對象:"ie.document.all("....")"
"ie.document.all.loginOnForm.submit"這行還顯示對象不支持此屬性或者方法
請各位大俠幫忙看看 哪里出了錯 謝謝啦
提問者: fxdca2008 - 試用期 一級
最佳答案
樓主代碼有幾處錯誤:
1. EndWhile應(yīng)為Wend
2. 網(wǎng)頁上的手機(jī)號碼、密碼等表單元域其實是在一個<iFrame>中的網(wǎng)頁上,不能直接調(diào)用,而應(yīng)該使
用ie.document.frames(0).document.loginOnForm...來調(diào)用
正確代碼如下(可以自動填寫交提交,提交上去以后會返回“識別碼錯誤”的提示,屬于正?,F(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ī)號碼
ie.document.frames(0).document.loginonform.passwd.Value = "111111" '密碼
ie.document.frames(0).document.loginonform.verifycode.Value = "1111" '識別碼
ie.document.frames(0).document.loginonform.submit
End Sub
相關(guān)文章
vbscript實現(xiàn)的根據(jù)不同時間段顯示不同的歡迎語
頁面加載時,瀏覽器遇到 Script 標(biāo)記。Script 標(biāo)記可能含有 Script 級代碼(不包含在過程之中),在對 HTML 頁面進(jìn)行語法分析時,將執(zhí)行此代碼。此代碼可使用瀏覽器提供的對象把內(nèi)容寫入頁面中2013-04-04
枚舉域內(nèi)計算機(jī)個數(shù)vbscript腳本(沒環(huán)境,沒測試)
枚舉域內(nèi)計算機(jī)個數(shù)的腳本,參考了微軟官方的代碼,有興趣的朋友可以參考下。2009-10-10
VBS教程:VBscript屬性-HelpContext 屬性
VBS教程:VBscript屬性-HelpContext 屬性...2006-11-11
用于修復(fù)XP中最小化程序 在任務(wù)欄顯示圖標(biāo)的vbs腳本
本腳本用于修復(fù)Windows XP中當(dāng)最小化程序時,無法在任務(wù)欄顯示圖標(biāo)的問題2009-05-05

