Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88066

Web Automation: Selecting Input From A Dropdown List

$
0
0

UPDATED HTML: I have posted the HTML fully expanded. I can sign onto the website just fine. Then, the first field I come to is a dropdown list. It has 173 elements to choose from. The element I need to select is "1000000173". I have tried the suggestions I have had no success populating the dropdown list.

This is the UPDATED 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">
    <option value="1000000001">1000000001  - Some Name1</option>
    <option value="1000000002">1000000002- Some Name2</option>  
    ‘ .................................. 170 more ..............
    ‘
    <option value="1000000173">1000000173  - Some Name173</option>
    <option value="1000000174">1000000174  - Some Name174</option>
</select>
<div title="" class="chosen-container chosen-container-multi chosen-with-drop chosen-container-active" id="MultiselectDDL_chosen" style="width: 198px;">
   <ul class="chosen-choices">

    ****** The bolded lines is what is highlighted when I chose “Inspect Element” on the dropdown list field. *******      
      <li class="search-field">
        <input class="chosen-search-input default valid" aria-invalid="false" style="width: 178px;" type="text" value="Enter at least 3 Characters"     autocomplete="off">
      </li>
     ****** End of the highlighted HTML *******

</ul>
<div class="chosen-drop">
  <ul class="chosen-results">
      <li class="active-result" data-option-array-index="0">1000000001  - Some Name1</li> 
      <li class="active-result" data-option-array-index="1">1000000002- Some Name2</li>
      <li class="active-result" data-option-array-index="2">1000000003  - Some Name3</li>
      <li class="active-result" data-option-array-index="3">1000000004  - Some Name4</li> 
      <li class="active-result" data-option-array-index="4">1000000005  - Some Name5</li>
   </ul>
</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 = "1000000173" 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

Viewing all articles
Browse latest Browse all 88066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>