I am trying to automate a web navigation. I am stuck at selecting the dropdown. This is what I have so far:
the_Start:
Dim i As Integer
Dim objIE As Object
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Top = 0
objIE.Left = 0
objIE.Width = 800
objIE.Height = 600
objIE.Visible = True
objIE.navigate ("https://suit.cibil.com")
With objIE
Do While .Busy
DoEvents
Loop
Do While .ReadyState <> 4
DoEvents
Loop
End With
While objIE.Busy
DoEvents
Wend
If objIE.Busy = False Then
Set the_input_elements = objIE.Document.getElementsByTagName("select")
For Each input_element In the_input_elements
If input_element.getAttribute("name") = "croreAccount" Then
'MsgBox ("Found croreAccount")
Set option1 = input_element.getElementsByTagName("option")
For Each dropdown1 In option1
If dropdown1.Value = "1" Then
'MsgBox dropdown1.Text
dropdown1.Focus
dropdown1.FireEvent ("onchange")
dropdown1.Click
dropdown1.Selected = "selected"
dropdown1.Selected = True
End If
Next
End If
Next
End If
End Sub
'This opens the website, and correctly takes me to option tab, but do not select them. Please help as' 'this is extremely repetetive work'
HTML
<select name="croreAccount" class="select" id="croreAccount" style="z-index: 10; opacity: 0;" onchange="changeQuarter(this);">
<option selected="selected" value="0">Option</option>
<option value="1">Search</option>
<option value="2">Summary - Credit Institutions Wise List</option>
<option value="3">Summary - State/Union Territory</option>
</select>
question from:https://stackoverflow.com/questions/66051020/unable-to-select-dropdown-on-website-in-excel-vba