Press on link inside table with vba on webpage

﹥>﹥吖頭↗ 提交于 2021-01-29 08:42:19

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!