Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Internet explorer HTA VBScript-IE CreateObject(InternetExplorer.Application)IE.Document.form1不';不支持属性或方法_Internet Explorer_Vbscript_Createobject - Fatal编程技术网

Internet explorer HTA VBScript-IE CreateObject(InternetExplorer.Application)IE.Document.form1不';不支持属性或方法

Internet explorer HTA VBScript-IE CreateObject(InternetExplorer.Application)IE.Document.form1不';不支持属性或方法,internet-explorer,vbscript,createobject,Internet Explorer,Vbscript,Createobject,我已经做过几次了,但是我不知道为什么这次我的HTA vbscript对我大喊大叫,说对象不支持这个属性或方法IE.Document.form1 忽略等待,即2000潜艇 Function server_details(server_name) dim returnArray(6) Set IE = CreateObject("InternetExplorer.Application") IE.Visible = True IE.Navigate "http://

我已经做过几次了,但是我不知道为什么这次我的HTA vbscript对我大喊大叫,说对象不支持这个属性或方法IE.Document.form1

忽略等待,即2000潜艇

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>


很难忽略您的等待sub,因为可能存在原因。您似乎使用了固定的时间量,而uou应该使用

Do Until IE.readyState = 4
  Wscript.Sleep 100
Loop
此外,如果出现问题,最好每行一个对象级别,这样更易于调试

With IE
  With .document
    With ...
并对其进行注释,直到其生效


这些都是一般性的指导原则,如果你发布真实的URL和你的wait sub,我们可以给出更直接的建议。

很难忽略你的wait sub,因为原因可能是存在的。您似乎使用了固定的时间量,而uou应该使用

Do Until IE.readyState = 4
  Wscript.Sleep 100
Loop
此外,如果出现问题,最好每行一个对象级别,这样更易于调试

With IE
  With .document
    With ...
并对其进行注释,直到其生效


这些都是一般性的指导原则,如果你发布真实的URL和你的wait sub,我们可以给出更直接的建议。

好的,那就解决它吧。iframe造成了所有的麻烦。对于那些具有相同错误消息的用户,请尝试检查表单和元素是否不属于您试图刮取的站点内的iframe。站点中的工作backwords获取iframe源代码并将其放入vbscript中,而不是您现有的脚本中


祝你好运

好吧,我想起来了。iframe造成了所有的麻烦。对于那些具有相同错误消息的用户,请尝试检查表单和元素是否不属于您试图刮取的站点内的iframe。站点中的工作backwords获取iframe源代码并将其放入vbscript中,而不是您现有的脚本中


祝你好运

这是一个HTA文档,因此我无法执行Wscript.Sleep。它在.form1 with语句中失败。然后使用window.setTimeout,您正在加载的url是什么?这是一个HTA文档,因此我无法执行Wscript.Sleep。它在.form1 with语句中失败。然后使用window.setTimeout,您正在加载的url是什么?确定可能有问题。看起来我要废弃的页面使用了iFrame。form1位于名为ct100\u ContentPlaceholder 1\u T1的iframe中。请参阅上面的编辑。确定可能有问题。看起来我要废弃的页面使用了iFrame。form1位于名为ct100\u ContentPlaceholder 1\u T1的iframe中。请参见上面的编辑。