我有这个代码来帮助从网页导入数据,但它可以在我需要点击“立即搜索”按钮的地方工作:(
知道哪里出错了吗?
谢谢
Sub test()
'define empty row
Dim eRow As Long
'q where retrived from html code
Set what = .document.getElementsByName("q")
what.Item(0).Value = myjobtype
Set zipcode = .document.getElementsByName("where")
zipcode.Item(0).Value = myzip
.document.getElementById("Search Now").Click
...
Set objIE = Nothing
End Sub
按钮的HTML代码
<button class="btn btn-jobsdotcom" type="submit">Search Now</button>
答案 0 :(得分:0)
您可以根据自己的要求参考和编辑以下代码。
Set ElementCol = ie.Document.getElementsByTagName("button")
For Each txt In ElementCol
If txt.innerText = "Search Now" Then
txt.Click
Exit For
End If
Next