本文介绍了使用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 NextWhere wb is the WebBrowser control.
更多推荐
使用VBA代码点击网页上的按钮
发布评论