我已经这样做了几次,但是我不确定为什么这次我的 HTA vbscript 对我大喊大叫 Object 不支持此属性或方法 IE.Document.form1?
忽略等待 IE,2000 subs。
Function server_details(server_name)
dim returnArray(6)
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate "http://website/Default.aspx"
Wait IE,2000
With IE.Document.form1
.txtServerName.value = server_name
.Button1.click
End With
Wait IE,4000
'get info returned
With IE.Document.all
serverOS = .txtOS.value
serverApp = .txtBusinessApp.value
serverClass = .txtServerClass.value
serverHost = .txtHost.value
serverEnv = .txtSupportEnvironment.value
serverCheckout = .txtCheckoutStatus.value
End With
IE.Quit
Set IE = Nothing
returnArray(0) = serverOS
returnArray(1) = ServerApp
returnArray(2) = serverClass
returnArray(3) = serverHost
returnArray(4) = serverEnv
returnArray(5) = serverCheckout
server_details = returnArray
End Function
我的 HTA vbscript 中也有这个功能,它工作正常。
Function subnetDetails(server_ip)
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = False
IE.Navigate "http://otherwebsite/detail.aspx"
Wait IE,2000
With IE.Document.aspnetForm
.[ctl00$_SUMMARY$txtIP].value = server_ip
.[ctl00$_SUMMARY$btnLoad].click
End With
'webscrape for TABLE id="ctl00_SUMMARY_gvSubnets"
Wait IE,9000
responseHTML = IE.Document.getElementByID("ctl00_SUMMARY_gvSubnets").outerHTML
IE.Quit
Set IE = Nothing
subnetDetails = responseHTML
End Function
发现 form1 在 iframe 中,可能是我无法引用它的原因。有任何想法吗?
<iframe id="ctl00_ContentPlaceHolder1_I1" bordercolor="White" name="I1" src="CSIS.aspx" style="border-style: none; overflow: auto; height: 2500px; width: 1100px;" frameborder="no" scrolling="no">
<html>
<head>
<body>
<form name="form1" bla bla"
</iframe>