I can get onto the website just fine. But, after I sign-on, the first field I come to is a dropdown list. It has 173 elements to choose from. The element I need to select is "1902897820". I am new to web automation. I have tried multiple examples I have seen on-line without success.
This is the HTML.
<div class="form-group">
<label class="col-sm-5 control-label" for="">NPI/Provider <span
class="requiredField">*</span> :</label>
<div class="col-sm-7">
<select name="NPI List" id="MultiselectDDL" style="width: 198px; height: 34px; display: none;" multiple="multiple"></select>
<div title="" class="chosen-container chosen-container-multi" id="MultiselectDDL_chosen" style="width: 198px;">
<ul class="chosen-choices">
<li class="search-field">
****** The bolded lines is what is highlighted when I chose “Inspect Element” on the dropdown list field. *******
<input class="chosen-search-input default valid" aria-invalid="false" style="width: 178px;" type="text" value="Enter at least 3
Characters"></input>
****** End of the highlighted HTML *******
</li>
</ul>
<div class="chosen-drop">...</div>
</div>
</div>
</div>
My VBA Code:
Sub SignOn_Cerner()
Dim oHTML_Element As IHTMLElement
Dim oBrowser As InternetExplorer
Dim IE As Object
Dim Element As String
Dim i As Long
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.navigate "https://www.azblue.com/individualsandfamilies/" ' Your webpage goes here
While IE.Busy = True Or IE.readyState <> 4: DoEvents: Wend
IE.document.getElementById("lockedcontent_0_maincolumn_1_twocolumn2fb4d204091d44aa08196ef423877fd9f_0_ToolbarUsernameControl").Value = "UserName"
Application.Wait (Now + TimeValue("0:00:01"))
IE.document.getElementById("lockedcontent_0_maincolumn_1_twocolumn2fb4d204091d44aa08196ef423877fd9f_0_ToolbarPasswordControl").Value = "Password"
Application.Wait (Now + TimeValue("0:00:01"))
IE.document.getElementById("lockedcontent_0_maincolumn_1_twocolumn2fb4d204091d44aa08196ef423877fd9f_0_ToolbarLoginButtonControl").Click
While IE.Busy = True Or IE.readyState <> 4: DoEvents: Wend
'**********This is my most recent effort ***********
Set Providor = IE.document.getElementById("MultiselectDDL_chosen")
For i = 1 To Providor.Options.Length
If Providor.Options(i).Text = "1902897820" Then
Providor.selectedIndex = i
Exit For
End If
Next i
'****************************************************
Application.Wait (Now + TimeValue("0:00:01"))
SendKeys "{TAB}"
Application.Wait (Now + TimeValue("0:00:01"))
SendKeys "{ENTER}"
Application.Wait (Now + TimeValue("0:00:01"))
End Sub
Of course, any help is greatly appreciated. Thanks!
Aucun commentaire:
Enregistrer un commentaire