在网页上按表格内与vba的链接 [英] Press on link inside table with vba on webpage

查看:55
本文介绍了在网页上按表格内与vba的链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想出了如何导航到该网页并使它搜索我的特定输入,因此第四.但是,当我得到结果列表时,我无法使vba单击它.我尝试了以下各种变化:

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.

推荐答案

您需要表的ID,而不是div的ID.然后是该表中的最后一个td

You want the id of the table, not the id of the div. Then the last td within that table

例如

ie.document.querySelector("td:last-child").Click

再试一次

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

With ie.document.querySelector("td:last-child")
    .Focus
    .FireEvent "onclick"
End With

这篇关于在网页上按表格内与vba的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆