I am working to auto-fill a form on a website and not able to get through this one field which is a dropdown list inside a element.
The HTML code appears as below, when I manually select the value on webpage, there is one more added (shown after HTML code).
<div class="county-select-input"><div class=" css-2b097c-container" id="OES_area"><div class=" css-yk16xz-control"><div class="css-1hwfws3"><div class=" css-1wa3eu0-placeholder">Type search term here</div><div class="css-1g6gooi"><div style="display: inline-block;"><style>input#react-select-3-input::-ms-clear {display: none;}</style><input tabindex="0" id="react-select-3-input" style="background: 0px; padding: 0px; outline: 0px; border: 0px currentColor; border-image: none; width: 19px; color: inherit; font-size: inherit; box-sizing: content-box; opacity: 1;" spellcheck="false" aria-autocomplete="list" type="text" value="" autoComplete="off" autoCapitalize="none" autoCorrect="off"><div style="left: 0px; top: 0px; height: 0px; text-transform: none; letter-spacing: normal; overflow: scroll; font-family: Source Sans Pro,Helvetica Neue,Helvetica,Roboto,Arial,sans-serif; font-size: 16px; font-style: normal; font-weight: 400; white-space: pre; visibility: hidden; position: absolute;"></div></div></div></div><div class="css-1wy0on6"><span class=" css-1okebmr-indicatorSeparator"></span><div class=" css-tlfecz-indicatorContainer" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" class="css-19bqh2r" aria-hidden="true" viewBox="0 0 20 20" focusable="false" width="20" height="20"><path d="M 4.516 7.548 c 0.436 -0.446 1.043 -0.481 1.576 0 l 3.908 3.747 l 3.908 -3.747 c 0.533 -0.481 1.141 -0.446 1.574 0 c 0.436 0.445 0.408 1.197 0 1.615 c -0.406 0.418 -4.695 4.502 -4.695 4.502 c -0.217 0.223 -0.502 0.335 -0.787 0.335 s -0.57 -0.112 -0.789 -0.335 c 0 0 -4.287 -4.084 -4.695 -4.502 s -0.436 -1.17 0 -1.615 Z" /></svg></div></div></div><input name="OES_area" type="hidden" value=""></div></div>
<div class="css-1uccc91-singleValue">Baldwin County - Daphne-Fairhope-Foley, AL</div>
This is how field looks like webpage
I have tried multiple ways to address this, no result.. posting two ways i tried. Option 1:
Dim inputfield_County As Object
Set inputfield_County = ie.Document.getElementsByClassName("css-1g6gooi")(0).getElementsByTagName("div")(0).getElementsByTagName("input")(0)
MsgBox inputfield_County
If inputfield.Length > 0 Then
inputfield_County(0).Focus
inputfield_County(0).Click
inputfield_County(0).Value = "Butler County - Southeast Alabama nonmetropolitan area"
Call iewait(ie)
End If
Option 2:
Dim HTMLdoc_County_00 As htmlDocument
Dim selectElement_County_00 As HTMLSelectElement
Dim evtChange_County_00 As Object
Set HTMLdoc_County_00 = ie.Document
Set evtChange_County_00 = HTMLdoc_County_00.createEvent("HTMLEvents")
evtChange_County_00.initEvent "change", True, False
Set selectElement_County_00 = HTMLdoc_County_00.getElementsByClassName("css-19bqh2r")(0)
selectElement_County_00.innerText = "Fayette County - Northwest Alabama nonmetropolitan area"'London1
'Set selectElement_County_00 = HTMLdoc_County_00.getElementsByClassName("css-1g6gooi")(0).getElementsByTagName("div")(0).getElementsByTagName("input")(0)
selectElement_County_00.Value = "Fayette County - Northwest Alabama nonmetropolitan area"'London1
'Set selectElement_County_00 = HTMLdoc_County_00.getElementsByClassName(" css-1wa3eu0-placeholder")(0)
' css-1wa3eu0-placeholder/ css-yk16xz-control/
MsgBox selectElement_County_00
'selectElement_County_00.Focus
'selectElement_County_00.Click
' selectElement_County_00.Value = "Fayette County - Northwest Alabama nonmetropolitan area"'London1
''MsgBox selectElement_County_00.innerText
' selectElement_County_00.dispatchEvent evtChange
Call iewait(ie)
Any help or guidance is highly appreciated...