shahin
Active Member
I'm trying to scrape a webpage with vba in combination with IE. The thing is i can fill in the required two search fields with my scraper but when i click on the search button, it throws an error as if i didn't put anything in the search boxes. It will be clearer when you see the below pictures. How can i initiate a click successfully?
Here is what I've tried so far:
Check out this two images:
Elements for the button:
Here is what I've tried so far:
Code:
Sub Get_Content()
Dim ie As New InternetExplorer, html As HTMLDocument
Dim itm As Object, post As Object, posts As Object
With ie
.Visible = True
.navigate "https://brokercheck.finra.org/"
Do Until .readyState = READYSTATE_COMPLETE: Loop
Set html = .document
End With
For Each itm In html.getElementsByTagName("input")
If InStr(itm.placeholder, "Name or CRD#") > 0 Then
itm.Value = "Michael John"
Exit For
End If
Next itm
For Each post In html.getElementsByTagName("input")
If InStr(post.placeholder, "Firm Name or CRD# (optional)") > 0 Then
post.Value = "Morgan Stanley"
Exit For
End If
Next post
Do While ie.Busy Or ie.readyState <> 4
DoEvents
Loop
html.getElementsByClassName("md-button")(0).Click
Do While ie.Busy Or ie.readyState <> 4
DoEvents
Loop
End Sub
Check out this two images:
Elements for the button:
Code:
<button class="md-raised md-primary md-hue-2 md-button md-ink-ripple" type="submit" ng-transclude="" aria-label="IndividualSearch"><div class="md-ripple-container" style=""></div></button>