简体   繁体   English

尝试使用 VBA 在 Internet Explorer 网页中自动化手动输入/过程,但使用 window 弹出值输入

[英]Trying to automate the manual entry/process in Internet Explorer webpage using VBA, but stuck with a window popup value entry

Automating the manual process in Internet explorer webpage using VBA.使用 VBA 在 Internet Explorer 网页中自动执行手动过程。 When clicking on a text box in a page, it displays a seperate Window Popup.单击页面中的文本框时,会显示一个单独的 Window 弹出窗口。

There is a text field in the window popup, where i have to enter a value, but no HTML code is associated to that popup(as i dont see Inspect element to get the HTML code). window 弹出窗口中有一个文本字段,我必须在其中输入一个值,但没有 HTML 代码与该弹出窗口相关联(因为我没有看到检查元素以获取 Z4C4AD5FCA2E7A3F74DBB1CED00381AA4 代码)。

So how do i get to the textbox in the window dialog box that pops up and enter the value??那么如何进入弹出的 window 对话框中的文本框并输入值? when there is no "inspect element" is available.当没有“检查元素”可用时。

Note: Webpage is access restricted,so cant share the link.注意:网页访问受限,所以不能分享链接。

Any help would be appreciated.任何帮助,将不胜感激。 enter image description here VBScript Image在此处输入图像描述VBScript 图像

Edit: from the screenshot that's not a javascript prompt input, so you can try something like the approach here: Automating the HTML document in an IE web dialog window? Edit: from the screenshot that's not a javascript prompt input, so you can try something like the approach here: Automating the HTML document in an IE web dialog window?

Or try overwriting the showModalDialog function:或者尝试覆盖showModalDialog function:

idoc.parentWindow.execScript _
           "window.showModalDialog = function(){return '09876';};", "JScript"

That sounds like javascript window.prompt() so you could try replacing that function in the page with a function that returns the value you'd want entered in the prompt when it pops up. That sounds like javascript window.prompt() so you could try replacing that function in the page with a function that returns the value you'd want entered in the prompt when it pops up.

Set elements = idoc.getElementsByName("userBSB") 

For Each oHTML_Element In idoc.getElementsByTagName("input") 
    If oHTML_Element.Name = "userBSB" Then 

       'override the window.prompt function
       idoc.parentWindow.execScript _
           "window.prompt = function(){return '09876';};", "JScript"  

       oHTML_Element.Click
       Exit For 
    End If
Next 

Do While ie.Busy = True Or ie.readyState < 4: DoEvents: Loop 

Application.Wait (Now() + TimeValue("00:00:3"))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM