我試圖運行VBS,但不斷收到錯誤。對象不支持此屬性或方法document.getElementById()。值
對象這麼想的支持此屬性或方法的document.getElementById()。價值 嘗試重置我的IE設置爲默認值,並使用IE的其他版本依然面臨同樣的問題
下面是腳本的詳細信息
strAssets = "Assets.txt"
strOutput = "AssetWarranties.csv"
strSite = "https://selfsolve.apple.com/agreementWarrantyDynamic.do"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Const intForReading = 1
Set objInput = objFSO.OpenTextFile(strAssets, intForReading, False)
Set objOutput = objFSO.CreateTextFile(strOutput, True)
objOutput.WriteLine """Serial"",""Status"",""Telephone Support"",""Expiry"",""Hardware Support"",""Expiry"""
While Not objInput.AtEndOfStream
\t strImei = Trim(objInput.ReadLine)
\t If strImei <> "" Then
\t \t Set objFF = CreateObject("InternetExplorer.Application")
\t \t objFF.Visible = True
\t \t objFF.Navigate strSite
\t \t While objFF.ReadyState <> 4 Or objFF.Busy
\t \t \t WScript.Sleep 100
\t \t Wend
\t \t objFF.document.getElementById("serialnumbercheck"). Value = strImei
\t \t objFF.document.getElementById("warrantycheckbutton"). Click()
\t \t While InStr(objFF.Document.body.InnerHTML, "<H3 id=registration-true>") = 0 And _
\t \t \t InStr(objFF.Document.body.InnerHTML, "<H3 id=registration-false>") = 0 And _
\t \t \t InStr(objFF.Document.body.InnerHTML, "serial number is not valid") = 0
\t \t \t WScript.Sleep 100
\t \t Wend
\t \t
\t \t strPageText = objFF.Document.body.InnerHTML
\t \t objFF.Quit
\t \t
\t \t If InStr(strPageText, "serial number is not valid") > 0 Then
\t \t \t 'WScript.Echo "Serial number is not valid"
\t \t \t objOutput.WriteLine """" & strImei & """,""Serial number is not valid"""
\t \t Else
\t \t \t strDetail = """" & strImei & """"
\t \t \t If InStr(strPageText, "<H3 id=registration-true>") > 0 Then
\t \t \t \t 'WScript.Echo "Valid Purchase Date"
\t \t \t \t strDetail = strDetail & ",""Valid Purchase Date"""
\t \t \t Else
\t \t \t \t 'WScript.Echo "Purchase Date not Validated"
\t \t \t \t strDetail = strDetail & ",""Purchase Date not Validated"""
\t \t \t End If
\t \t \t If InStr(strPageText, "<H3 id=phone-true>") > 0 Then
\t \t \t \t 'WScript.Echo "Telephone Technical Support: Active"
\t \t \t \t strDetail = strDetail & ",""Telephone Technical Support: Active"""
\t \t \t \t intPos = InStr(InStr(strPageText, "<H3 id=phone-true>"), strPageText, "Estimated Expiration Date: ")
\t \t \t \t If intPos > 0 Then
\t \t \t \t \t strExpiration = Mid(strPageText, intPos, InStr(intPos, strPageText, "</P>") - intPos)
\t \t \t \t \t 'WScript.Echo strExpiration
\t \t \t \t \t strDetail = strDetail & ",""" & strExpiration & """"
\t \t \t \t Else
\t \t \t \t \t 'WScript.Echo "Estimated Expiration Date: UNKNOWN"
\t \t \t \t \t strDetail = strDetail & ",""Estimated Expiration Date: UNKNOWN"""
\t \t \t \t End If
\t \t \t Else
\t \t \t \t 'WScript.Echo "Telephone Technical Support: Expired"
\t \t \t \t strDetail = strDetail & ",""Telephone Technical Support: Expired"""
\t \t \t End If
\t \t \t If InStr(strPageText, "<H3 id=hardware-true>") > 0 Then
\t \t \t \t 'WScript.Echo "Repairs and Service Coverage: Active"
\t \t \t \t strDetail = strDetail & ",""Repairs and Service Coverage: Active"""
\t \t \t \t intPos = InStr(InStr(strPageText, "<H3 id=hardware-true>"), strPageText, "Estimated Expiration Date: ")
\t \t \t \t If intPos > 0 Then
\t \t \t \t \t strExpiration = Mid(strPageText, intPos, InStr(intPos, strPageText, "<BR>") - intPos)
\t \t \t \t \t 'WScript.Echo strExpiration
\t \t \t \t \t strDetail = strDetail & ",""" & strExpiration & """"
\t \t \t \t Else
\t \t \t \t \t 'WScript.Echo "Estimated Expiration Date: UNKNOWN"
\t \t \t \t \t strDetail = strDetail & ",""Estimated Expiration Date: UNKNOWN"""
\t \t \t \t End If
\t \t \t Else
\t \t \t \t 'WScript.Echo "Repairs and Service Coverage: Not Active"
\t \t \t \t strDetail = strDetail & ",""Repairs and Service Coverage: Not Active"""
\t \t \t End If
\t \t \t objOutput.WriteLine strDetail
\t \t End If
\t End If
Wend
objInput.Close
objOutput.Close
WScript.Echo "Done"