[英]Trying to automate the manual entry/process in Internet Explorer webpage using VBA, but stuck with a window popup value entry
使用 VBA 在 Internet Explorer 网页中自动执行手动过程。 单击页面中的文本框时,会显示一个单独的 Window 弹出窗口。
window 弹出窗口中有一个文本字段,我必须在其中输入一个值,但没有 HTML 代码与该弹出窗口相关联(因为我没有看到检查元素以获取 Z4C4AD5FCA2E7A3F74DBB1CED00381AA4 代码)。
那么如何进入弹出的 window 对话框中的文本框并输入值? 当没有“检查元素”可用时。
注意:网页访问受限,所以不能分享链接。
任何帮助,将不胜感激。 在此处输入图像描述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?
或者尝试覆盖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.
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.