none
Document Complete Event Is not Raising in Internet explorer 11

    Question

  • using System;
    using System.Windows.Forms;
    using SHDocVw;
    
    namespace IE11_POC
    {
        public partial class Form1 : Form
        {
            InternetExplorer IE;
    
        public Form1()
        {
            InitializeComponent();
        }
    
        private void button1_Click(object sender, EventArgs e)
        {
    
            IE = new InternetExplorer();
            IE.Visible = true;
    
            IE.DocumentComplete += IE_DocumentComplete;
            IE.Navigate("http://stackoverflow.com/");
    
        }
    
    
        void IE_DocumentComplete(object pDisp, ref object URL)
        {
            MessageBox.Show(URL.ToString());
        }
    
    }
    }

    Got one very weird scenario on Internet explorer 11. I have written one C# automated program for Internet explorer which was working fine till IE 10, now suddenly from IE 11, document complete stopped to raise more them 8 out of 10 times.

    Just take an example of above code.

    it will show Message box for the first time then it will never show that.


    Thursday, December 26, 2013 5:58 AM

All replies

  • Hi,

    This is strange, it works fine on my machine(Win8.1, IE11). Every time I click, the URL is navigated, and then the DocumentComplete method will be called. Actually the event will be fired twice the first time I click the button.

    There is a saying that the DocumentComplete event will not be fired when you set Visible to false, but I'm not sure if IE11 still has this problem:

    BUG: DocumentComplete Does Not Fire When WebBrowser Is Not Visible

    Please check if you set it to false in your original code.

    And please check if the solution in this thread works:

    Only DocumentComplete not fired - on some computers


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, December 27, 2013 8:54 AM
    Moderator
  • Hi, Thanks for your reply.

    But I am using win 7 enterprise, with IE 11.

    Go to http://www.automationanywhere.com/Testing/ document complete message box will appear, then go to any menu items, message box would never appear.

    I literally got stuck here, I tried all the options like removed old references of shdocvw and mshtml and re-added those, but it doesn't work.


    Friday, December 27, 2013 10:04 AM
  • Hi again,

    I happened to have a win7 enterprise testing machine, and I upgraded IE8 to IE11 by downloading from this site: http://windows.microsoft.com/en-in/internet-explorer/ie-11-worldwide-languages, I chose English/Windows 7 SP1 64-bit version(my OS had the SP1 patch installed previously). Then I copied your code and run again. Whether I used http://stackoverflow.com/ or "http://www.automationanywhere.com/Testing/", both the raw url or any of the menu items will raise the document complete message box.

    So I think there might be some problem with the installation of IE11 on you machine, I would like you to download from the official downloading site of IE11 and reinstall it. Then check if the code works for you.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, December 31, 2013 4:04 AM
    Moderator
  • Hey Zhong,

    Thanks for the reply.

    I re-installed Internet Explorer 11 on my laptop and tried the same thing, but no luck.

    I have recorded the same thing here and uploaded Here.


    Wednesday, January 01, 2014 8:58 AM
  • Add the event handler in the Load event so there is only one event handler.  Check the ReadyState in the DoocumentComplete event handler.
    Wednesday, January 01, 2014 4:55 PM
  • Have you checked if the same issue occurs when you use an embedded WebBrowser control, inserted in your form as a child control, instead of launching a separate Internet Explorer application?

    Wednesday, January 01, 2014 7:41 PM
  • Hi Viorel,

    It is working fine there.

    Thursday, January 02, 2014 5:15 AM
  • Then you could use WebBrowser control instead.

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, January 02, 2014 5:18 AM
    Moderator
  • No No,

    I have a testing product which is being used by so many customers. Everything was working fine till time but few of them got updated to IE 11 and now they are raising this complains.


    Thursday, January 02, 2014 5:24 AM
  • Hi

    I can confirm I am seeing the same problem on IE11 running on RDS 2012 R2 with IE11 - using just the normal web browser with an Enterprise Single Sign On solution that installs a BHO to the browser. We have eliminated most variables but we do have something to add:

    We can see in the trace logs, the SSO solution is waiting for the DocumentComplete event to trigger even after the page load has completed. If we wait ten seconds then hit F12 or right-click in the username box and select "Inspect Element", the logs indicate DocumentComplete has triggered and it then fills in the username and password fields.


    Tim Staddon



    • Edited by tstaddon Monday, January 13, 2014 11:15 AM Clarification
    Monday, January 13, 2014 11:13 AM
  • Yeah Tim,

    Do you have anything which can resolve this issue?

    sorry for my late reply.

    Monday, January 20, 2014 7:38 PM
  • Hi,

    Is there any update on this?

    Wednesday, January 29, 2014 5:58 AM