簡體   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

使用 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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM