我正在尝试访问网站,在文本框中键入一个值,然后单击搜索按钮来搜索我的值。
我的问题是,我无法获取按钮元素来触发单击事件。
VBA:
Dim i As Long
Dim objElement As Object
Dim objCollection As Object
Dim result(2) As String
Dim timeout As Integer
Dim test As Object 'testweise
If IE Is Nothing = False Then
IE.Quit
End If
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
Start:
' Send the form data To URL As POST binary request
IE.navigate "https://www.bundesanzeiger.de/ebanzwww/wexsservlet"
' Wait while IE loading...
Do While IE.Busy
DoEvents
Application.Wait DateAdd("s", 1, Now)
Loop
IE.Document.getElementbyid("genericsearch_param.fulltext").Value = "Mielke"
IE.Document.getElementbyid("(page.navid=to_quicksearchlist)").Click
HTML
<div class="bbg"><input name="(page.navid=to_quicksearchlist)" type="submit" alt="Suchen" value="Suchen"></div>
第二个 getElement 调用应该获取按钮,但该对象为 null。
有谁知道我哪里做错了?
Replace:
IE.Document.getElementbyid("(page.navid=to_quicksearchlist)").Click
with:
Set x = IE.Document.GetElementsByName("(page.navid=to_quicksearchlist)")
x(0).Click
您需要通过以下方式查找元素Name不是Id
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)