Getting HRESULT: 0x800A01B6 Exception while getting elements from InternetExplorerMedium website

1

I'm trying to make some code on VB.net that opens a website and logs in, and after that runs a report. Everything has been working fine when I try to get any of the from the website, but the ones that have this instruction within the OnClick property = "return oamSubmitForm('inputParamView:paramForm','inputParamView:paramForm:_idJsp106');"

Basically, if you see the following code, you see that I click on some of the CheckBoxes and it works just fine, but when I retrieve the button, it doesn't type an input, it actually has the link of the website when I use a whatc while debugging.

This is my code (I skipped the login section):

Private Sub open Page()
ieb = New SHDocVw.InternetExplorerMedium()
ieb.Navigate("http://example.example/qptheme2/pages/index.faces")
ieb.visible = True
ieb.Silent = True

While Not (ieb.ReadyState = WebBrowserReadyState.Complete)
    Application.DoEvents()
End While

If v.checked = False Then
    v.Click()
End If

v = ie.Document.GetElementById("inputParamView:paramForm:inputParametertuesday")

If v.checked = False Then
    v.Click()
End If

v = ie.Document.GetElementById("inputParamView:paramForm:_idJsp106")

v.Click() '<-- IT FAILS HERE Exception HRESULT: 0x800A01B6

If I check the watch it shows mshtml.HTMLAnchorElementClass {http://example.example/qpreport/savedpages/savedReports.faces#} if I check the source code from the page, this is the element that I'm trying to get:

<a id="inputParamView:paramForm:_idJsp106" onclick="return
oamSubmitForm('inputParamView:paramForm','inputParamView:paramForm:_idJsp106');" href="#"

I don't know if it has anything to do with the property OnClick.

I will appreciate any of your help trying to solve this issue.

vb.net
vba
hresult
asked on Stack Overflow Sep 25, 2014 by Mengoni • edited Sep 25, 2014 by Daniel

1 Answer

2

I found the solution by myself. I just had to instance the element I was retrieving as mshtml.HTMLAnchorElementClass after that, I was able to click on it.

Dim l As mshtml.HTMLAnchorElementClass = ieb.Document.GetElementById("inputParamView:paramForm:_idJsp106")
l.click()
answered on Stack Overflow Sep 25, 2014 by Mengoni • edited Dec 1, 2016 by Ajeet Shah

User contributions licensed under CC BY-SA 3.0