问题
I figured out how to navigate to the webpage and make it search for my specific input and so fourth. However when i get the list with the result i am not able to make vba click on it. I have tried different variations of:
objIE.document.getElementById("isc_ListGrid_1_body$28s").Click
But I'm unable to figure how to press the specifc cell (marked in blue in pic):
https://imgur.com/inH25WQ
I'm not getting any error's, but its not click on it either.
回答1:
You want the id of the table, not the id of the div. Then the last td within that table
e.g.
ie.document.querySelector("td:last-child").Click
Try alternatively
Dim evt As Object
Set evt = ie.document.createEvent("HTMLEvents")
evt.initEvent "onclick", True, False
With ie.document.querySelector("td:last-child")
.Focus
.dispatchEvent evt
End With
Or
With ie.document.querySelector("td:last-child")
.Focus
.FireEvent "onclick"
End With
来源:https://stackoverflow.com/questions/56653330/press-on-link-inside-table-with-vba-on-webpage