使用VBA代码点击网页上的按钮 [英] Use VBA code to click on a button on webpage

查看:5331
本文介绍了使用VBA代码点击网页上的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编辑一个vba程序,并希望对vba进行编码,以单击网页中的按钮。该按钮的HTML是:

 < input type =imagesrc =/ lihtml / test_button3.gifalign =leftalt =File_Certificate_Go/> 

我想我必须设置一个变量getElementBy ???然后variable.click,但我不知道如何准确地获取元素(因为它没有一个名称或ID,我不能给它一个,因为它不是我的网页)。



任何帮助都非常感谢!

解决方案

可能是以下行的:

 设置tags = wb.Document.GetElementsByTagname(Input)

对于每个tagx在标记中
如果tagx.alt =File_Certificate_Gothen
tagx 。Click
End If
Next

其中wb是WebBrowser控件。 / p>

I am editing a vba program and want to code the vba to click on a button in a webpage. The html for the button is:

<input type="image" src="/lihtml/test_button3.gif" align="left" alt="File_Certificate_Go"/>

I imagine I would have to set a variable to getElementBy??? and then variable.click, but I can't figure out how exactly to get the element (because it doesn't have a name or id, and I can't give it one because it is not my webpage).

Any help is greatly appreciated!

解决方案

Perhaps something on the lines of:

Set tags = wb.Document.GetElementsByTagname("Input")

For Each tagx In tags
    If tagx.alt = "File_Certificate_Go" Then
        tagx.Click
    End If
Next

Where wb is the WebBrowser control.

这篇关于使用VBA代码点击网页上的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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