简体   繁体   中英

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. When clicking on a text box in a page, it displays a seperate Window Popup.

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).

So how do i get to the textbox in the window dialog box that pops up and enter the value?? 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

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:

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"))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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