mshtml.IHTMLDocument returning nothing

0

I have the below code trying to access a webpage and the program is erroring out at a test for the innerHTML property. Below is the code:

 iex = GetObject("new:{D5E8041D-920F-45e9-B8FB-B1DEB82C6E5E}")
 iex.visible = True
 iex.navigate("https://url.aspx")

 While iex.readystate <> 4 Or iex.busy
      Application.DoEvents()
 End While

 Dim htdoc As mshtml.IHTMLDocument = iex.Document
 Dim htstring As mshtml.IHTMLBodyElement = htdoc.body
 If (InStr(htstring.innerHTML, "An error occured while processing your request") > 0) Then

The last line is where it gets the error. And I have determined that it gets the error because htdoc is nothing, resulting in everything else being nothing. At least, that is what I believe the issue to be.

After further troubleshooting, the below line is what is causing the error.

 mshtml.IHTMLBodyElement = htdoc.body 

The exception error is:

Message = Exception from HRESULT: 0x800A01B6

Item = In order to evaluate an indexed property, the property must be qualified and the arguments must be explicitly supplied by the user.

This was working before IE was updated to IE11 (I don't recall what version it was prior, but I would assume it was IE10).

I don't think I am doing anything wrong, but any help you could provide would be greatly beneficial!

vb.net
asked on Stack Overflow Dec 8, 2016 by Jon • edited Dec 8, 2016 by Jon

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0