sthack99
Board Regular
- Joined
- May 16, 2006
- Messages
- 237
Hi all. I have developed a code that will go to a county court website, search for a case, extract information about it, then close the site and go on to the next. I have a different sub routine that runs for each county. The problem I am having is that the current county I'm working on (Duval) will not let you click the "Open Case" button - the button remains greyed out until (I'm guessing) it detects keystrokes in the search box. Because the code populates the search box automatically, the button remains greyed out and the code hits a brick wall, so to speak. Please see if you can help me find a way around this!
Here's an example Case Number: 2013ca002119
The username and password is not shown, but it's free to create an account if you want to.
Duval county's sub code:
The button's source code:
(The ****** say "on click", without a space. Not sure why it stars that part out.)
Here's an example Case Number: 2013ca002119
The username and password is not shown, but it's free to create an account if you want to.
Duval county's sub code:
Code:
'Sub code for Duval county
Sub Duval(CaseNbr As String, RowNbr As Integer)
'On Error GoTo ErrHandler 'What to do if the code encounters an error.
Dim IE As Object
Dim doc As Object
Dim links As Object
Dim CaseStatus As Object
Dim itms As Object
Dim itm As Object
Dim fields As Object
Dim field As Object
Set IE = CreateObject("InternetExplorer.Application")
'Go to county website
IE.navigate "https://core.duvalclerk.com/CoreCms.aspx"
IE.Visible = True
Do
DoEvents
Loop Until IE.readyState = 4
Sleep 1000
Set doc = IE.Document
doc.getElementByID("c_UsernameTextBox").Value = UserName '**USERNAME HIDDEN
doc.getElementByID("c_PasswordTextBox").Value = Password '**PASSWORD HIDDEN
Set itms = doc.getElementsByTagName("input")
For Each itm In itms
If itm.Type = "submit" Then
itm.Click
Exit For
End If
Next itm
Sleep 3000
Set itm = doc.getElementsByTagName("input")
For Each itm In itms
If itm.Type = "text" And itm.Value <> "1:0" Then
itm.Value = CaseNbr
Exit For
End If
Next itm
Sleep 500
'**THIS IS WHERE IT'S GETTING STUCK**
Set itm = doc.getElementsByTagName("input")
For Each itm In itms
If itm.Type = "button" Then
itm.Click
Exit For
End If
Next itm
Sleep 3000
'Retrieve info from table
Set CaseStatus = doc.getElementsByTagName("TABLE")(3)
ActiveSheet.Range("I" & RowNbr).Value = CaseStatus.Rows(2).Cells(1).innertext
'Since there is no visible unique URL for the docket, a copy of the docket must be saved to the user's computer
strHTML = IE.Document.DocumentElement.innerhtml
FileLoc = "C:\Users\sarat\Desktop\Case Status\Docket Reports\" & ActiveSheet.Range("A" & RowNbr).Value & "-Docket.html"
Open FileLoc For Output As #1
Print #1, strHTML
Close #1
ActiveSheet.Hyperlinks.Add Anchor:=Range("J" & RowNbr), Address:=FileLoc, TextToDisplay:="Docket" 'Link to saved docket file
'exithere:
'
IE.Quit
'
'Exit Sub
'
'ErrHandler:
' ActiveSheet.Range("I" & RowNbr).Value = "N/A"
' ActiveSheet.Range("J" & RowNbr).Value = "N/A"
' Resume exithere
End Sub
The button's source code:
HTML:
<INPUT *******='javascript:getCaseTabByUcnBoxId("c_UcnEntryBox_adbfe763_6470_4337_8bce_634e1985e257");' disabled id=c_SubmitCaseLookupButton_adbfe763_6470_4337_8bce_634e1985e257 class=aspNetDisabled type=button value="Open Case" name=c_SubmitCaseLookupButton_adbfe763_6470_4337_8bce_634e1985e257>
(The ****** say "on click", without a space. Not sure why it stars that part out.)