Search code examples
c#internet-explorerexceptionautomationmshtml

document.readystate throwing COMException


I am working on a mshtml C# IE 11 automation based project, when I log in to the website and check the readystate property of the document, it throws a COMException. The same code works for IE 8 without any issue:

while (document.readyState != "complete")
{
//do nothing
}

Can someone please help?


Solution

  • Try document.readyState instead of doc.readyState