我在搜索框中輸入文本時遇到了一些麻煩,因爲我認爲這是相關ID標記。我從頁面的源代碼中獲得了ID。我之前在其他網站上做過這個。有人可以幫我嗎?有沒有另一種方法來做到這一點?VBA - IE GetElementByID不能正常工作
Sub FileUpload()
Dim IEexp as Object
IEexp.visible = True
IEexp.Navigate ("www.example.com")
'this is where the problem
IEexp.Document.GetElementByID("step1_id_bean_newSupportingDoc_description").Value _
= "monthly update"
End Sub
我得到一個 「自動化錯誤調用該對象已經與其客戶端斷開」 我來自哪裏拉ID
源代碼:
<td class="Label">Description</td>
<td class="Data"><input type="text" name="bean.newSupportingDoc.description" size="60" maxlength="250" value="" id="step1_id_bean_newSupportingDoc_description" class="NoBorder"/>
</td>
您是否正在等待文檔在嘗試訪問輸入元素之前加載? – 2013-03-06 21:12:52
我在本地運行它,我等待頁面加載事件發生,我得到iwebbrowser2錯誤 – user1902540 2013-03-07 14:52:15
是的,我已經運行在休息模式,所以我等待,直到頁面完全加載,我仍然得到該錯誤。 – 2013-03-07 15:22:03