Handle Pop-Up While Navigating with IE

前端 未结 2 1754
独厮守ぢ
独厮守ぢ 2020-12-20 04:19

I have an Excel VBA macro that

  1. opens IE,
  2. navigates to the Medicare website,
  3. logs me in,
  4. compares the claims listed on the website wit
相关标签:
2条回答
  • 2020-12-20 04:59

    Try Application.SendKeys "{ENTER}", True after your login code.

    Also, try adding Do: DoEvents: Loop Until Not objIE.Busy and Do While objIE.readyState <> 4: DoEvents: Loop any time you need a page to load. In my experience, coupling the two together works pretty well, whereas using just one or the other can sometimes produce errors and using Application.Wait can slow down your code unecessarily.

    0 讨论(0)
  • 2020-12-20 05:04

    In case anyone passes this way again, here is the solution provided by Tim Williams:

    'Log-in 
    
    ie.Document.all.Item"ctl00_ContentPlaceHolder1_ctl00_HomePage_SWEUserName").Value= "abcde"
    
    ie.Document.all.Item("ctl00_ContentPlaceHolder1_ctl00_HomePage_SWEPassword").Value = "12345"
    
    Dim f As String
    
    f = "function(SignIn){document.getElementById'ctl00_ContentPlaceHolder1_ctl00_HomePage_Agree').value = 'True';}"
    
    ie.Document.parentWindow.execScript "window.ConfirmationPopup = " & f, "jscript"
    
    ie.Document.getElementById("ctl00_ContentPlaceHolder1_ctl00_HomePage_SignIn").Click
    
    0 讨论(0)
提交回复
热议问题