Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/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 使用VBS启动多模块IE选项卡并填充用户名和组织_Internet Explorer_Vbscript - Fatal编程技术网

Internet explorer 使用VBS启动多模块IE选项卡并填充用户名和组织

Internet explorer 使用VBS启动多模块IE选项卡并填充用户名和组织,internet-explorer,vbscript,Internet Explorer,Vbscript,我从其他地方拼凑了这段代码,它可以打开选项卡并将登录信息放在第一个选项卡上。问题是它会用后续选项卡的所有登录信息覆盖第一个选项卡。只有第一个选项卡接收登录信息。如何将登录信息发送到VBS中的每个选项卡 const navOpenInNewTab = &h0800 Set IE = CreateObject("InternetExplorer.Application") set WshShell = WScript.CreateObject("WScript.Shell") IE.N

我从其他地方拼凑了这段代码,它可以打开选项卡并将登录信息放在第一个选项卡上。问题是它会用后续选项卡的所有登录信息覆盖第一个选项卡。只有第一个选项卡接收登录信息。如何将登录信息发送到VBS中的每个选项卡

const navOpenInNewTab = &h0800
Set IE = CreateObject("InternetExplorer.Application") 
set WshShell = WScript.CreateObject("WScript.Shell")  
IE.Navigate "https://testurl.com"
IE.Visible = True 
Wscript.Sleep 2000 
ie.Document.getElementById("organization").value = "MyOrg1"
ie.Document.getElementById("userName").value = "esmith1"

IE.Navigate "https://testural.com",CLng(navOpenInNewTab) 
ie.Document.getElementById("organization").value = "MyOrg2"
ie.Document.getElementById("userName").value = "esmith2"
IE.Visible = True

IE.Navigate "https://testural.com",CLng(navOpenInNewTab) 
ie.Document.getElementById("organization").value = "MyOrg3"
ie.Document.getElementById("userName").value = "esmith3"
IE.Visible = True
今天代码完成后,第一个选项卡上有MyOrg3和esmith3。其他选项卡为空。

参考:

注意异步打开新选项卡;此方法在创建选项卡时立即返回,这可能是在新选项卡中的导航开始之前。调用方无法使用目标选项卡的IWebBrowser2接口。制表符顺序是不能保证的,尤其是当这个方法在一行中被快速调用多次时


当指定navOpenInNewWindow或navOpenInNewTab时,调用方不会收到指向新窗口的IWebBrowser2接口的指针,因此无法立即对其进行操作。

自动登录通常通过服务器端代码(在会话\u start()上嗅探站点cookie中的令牌)和登录屏幕上的“让我登录”选项,或使用IE内置的表单填写或第三方表单填写插件。通常情况下,用户会设置一组url主页,并通过持久凭据验证,IE会在用户访问该站点的最后一页自动打开每个url。