您好,我在本网站提交搜索表单时遇到问题。 http://www.hcdistrictclerk.com/edocs/public/search.aspx 我的代码似乎适用于填写表单。 然而,之后,它尝试单击搜索按钮,表单似乎被清理,没有结果返回。 当我删除该特定行时:.all(" ctl00 $ ctl00 $ ctl00 $ ContentPlaceHolder1 $ ContentPlaceHolder2 $ ContentPlaceHolder2 $ btnSearch")。点击 并手动点击搜索按钮,一切似乎都没问题。 任何人都可以帮助我吗?
我的代码:
`
Sub test() Dim searchURL, entity, paintiff, defendent As String Dim i, k As Integer plaintiff = "ctl00$ctl00$ctl00$ContentPlaceHolder1$ContentPlaceHolder2$ContentPlaceHolder2$tabSearch$tabCivil$txtPlaintiff" k = Sheet1.Range("a65536").End(xlUp).Row Set IE = CreateObject("internetexplorer.application") Web_Address = "http://www.hcdistrictclerk.com/edocs/public/search.aspx" ' Access the Webpage IE.Navigate Web_Address IE.Visible = True Start: ' Wait while IE loading... Do While IE.Busy Application.Wait DateAdd("s", 5, Now) Loop For i = 1 To k entity = Cells(i, 1) With IE.document.forms(0) .all(plaintiff).Value = entity .Submit .all("ctl00$ctl00$ctl00$ContentPlaceHolder1$ContentPlaceHolder2$ContentPlaceHolder2$btnSearch").Click 'This line seems to reset the form before submitting for search 'So it gives me no result 'If I delete this line and click the search button manually, everything works fine End With Next i
`
End Sub