I'm new in VBA and i'm trying to automate a web Explorer navigation but with many difficolties. I've composed a script that navigate into a web page and search for a code. the result is a table ("dr-table-cell rich-table-cell") with one row that contains the searched item ("02090000062571") displayed as a link to another page. Here the code of that table:
<td class="dr-table-cell rich-table-cell"
id="formRicercaPdr:pdrTable:0:j_id134">
<a onclick="if(typeof jsfcljs == 'function'){jsfcljs(document.forms['formRicercaPdr'],'formRicercaPdr:pdrTable:0:j_id136,formRicercaPdr:pdrTable:0:j_id136','');}return false"
href="#">02090000062571</a>
</td>
My problem is to click on "02090000062571" href button (is the searched item) and execute the javascript fuction that diplayed another table.
Here my code:
Sub TriggerDivClick()
Dim ie As SHDocVw.InternetExplorer
Dim doc As MSHTML.HTMLDocument
Dim div As HTMLDivElement
Dim url As String
url = "some URL"
Set ie = New SHDocVw.InternetExplorer
ie.Visible = True
ie.Navigate url
While ie.Busy Or ie.ReadyState <> READYSTATE_COMPLETE
DoEvents
Wend
Set pdr_button = ie.Document.getElementsByClassName("dr-table-cell rich-table-cell")
For Each a In pdr_button
'here comes the problems
a.Item(0).FireEvent ("click()")
Next a
End Sub
I can find the item but I can't execute the code in order to press the button. I'm using IE 11.
Thanks for your patience!.
ie.Document.getElementById("formRicercaPdr:pdrTable:0:j_id134").getElementsByTagName("a")(0).Click