title: Web automation login input box trouble
body: <p>I'm trying to automate a few things around the office and this program is supposed to log into our insurance companies website and pull information for use by payroll.  Here is the function I use to input values in the webpage.</p>
  <pre><code>Public Function SetElement(Doc As HTMLDocument, MType As String, SelState As String, _
  vInPut As Variant, Optional aIndex As Long = 0, Optional milSec As Long = 0) As Long
  SetElement = 0
  Sleep milSec
  On Error GoTo Failed
  Select Case MType
      Case &quot;I&quot;: Doc.getElementById(SelState).Value = vInPut: SetElement = 1
      Case &quot;N&quot;: Doc.getElementsByName(SelState)(aIndex).Value = vInPut: SetElement = 1
      Case &quot;C&quot;: Doc.getElementsByClassName(SelState)(aIndex).Value = vInPut: SetElement = 1
      Case &quot;T&quot;: Doc.getElementsByTagName(SelState)(aIndex).Value = vInPut: SetElement = 1
      Case &quot;Q&quot;: Doc.querySelector(SelState).Value = vInPut: SetElement = 1
  End Select
  Failed:
  End Function
  </code></pre>
  <p>Here is the function call as it appears in the main sub</p>
  <pre><code>i = 0: Do While i = 0
      i = SetElement(Doc, &quot;N&quot;, &quot;loginEmail&quot;, lcLogin, 0, 500)
  Loop
  </code></pre>
  <p>The correct username get put into the text box on the webpage, but when the code clicks the login button red text appears under the username and password asking me to put a username (same issue for the password box too).</p>
  <p>Here is the website HTML for the input box</p>
  <pre><code>&lt;input name=&quot;loginEmail&quot; class=&quot;form-control gbx-unmasked ng-pristine ng-valid ng-touched&quot; id=&quot;loginEmail&quot; aria-label=&quot;Email&quot; type=&quot;email&quot; maxlength=&quot;64&quot; placeholder=&quot;&quot; value=&quot;&quot; data-dl='{&quot;event&quot;:&quot;change&quot;,&quot;da_track&quot;:&quot;true&quot;,&quot;interaction_only&quot;:&quot;true&quot;}' _ngcontent-qql-c18=&quot;&quot; autocapitalize=&quot;off&quot; autocomplete=&quot;off&quot; autocorrect=&quot;off&quot;&gt;
  </code></pre>
  <p>If I click the input box and type in a single character and delete it in either the username or password boxes the website behaves as if it now has the correct values.  If i had to make an educated guess this has something to do with the &quot;data-dl='{&quot;event&quot;:&quot;change&quot;,&quot;da_track&quot;:&quot;true&quot;,&quot;interaction_only&quot;:&quot;true&quot;}&quot; bit of code.</p>
  <p>found a good HTML formatter so here is the entire code for the input box.</p>
  <pre><code>&lt;div class=&quot;col-xs-12 no-padding&quot; _ngcontent-upe-c11=&quot;&quot;&gt;
  &lt;primary-form-text-input
      class=&quot;ng-touched ng-dirty ng-valid&quot;
      _ngcontent-upe-c11=&quot;&quot;
      CustomGridClass=&quot;email-field&quot;
      formControlName=&quot;loginEmail&quot;
      inputId=&quot;loginEmail&quot;
      inputPlaceholder=&quot;&quot;
      inputType=&quot;email&quot;
      isAutoFocus=&quot;true&quot;
      labelName=&quot;Email&quot;
      maxlength=&quot;64&quot;
      ngDefaultControl=&quot;&quot;
      textType=&quot;text&quot;
      _nghost-upe-c14=&quot;&quot;
  &gt;
      &lt;div class=&quot;row form-group has-feedback&quot; _ngcontent-upe-c14=&quot;&quot;&gt;
          &lt;!----&gt;
          &lt;app-tertiary-page-label _ngcontent-upe-c14=&quot;&quot; _nghost-upe-c17=&quot;&quot;&gt;
              &lt;div _ngcontent-upe-c17=&quot;&quot;&gt;
                  &lt;label class=&quot;control-label&quot; for=&quot;loginEmail&quot; _ngcontent-upe-c17=&quot;&quot;&gt;&lt;em _ngcontent-upe-c17=&quot;&quot;&gt;&lt;/em&gt;Email &lt;/label&gt;
              &lt;/div&gt;
          &lt;/app-tertiary-page-label&gt;
          &lt;div class=&quot;email-field&quot; _ngcontent-upe-c14=&quot;&quot;&gt;
              &lt;primary-text-input _ngcontent-upe-c14=&quot;&quot; _nghost-upe-c18=&quot;&quot;&gt;
                  &lt;div style=&quot;position: relative;&quot; _ngcontent-upe-c18=&quot;&quot;&gt;
                      &lt;!----&gt;
                      &lt;input
                          name=&quot;loginEmail&quot;
                          class=&quot;form-control gbx-unmasked ng-touched ng-dirty ng-valid&quot;
                          id=&quot;loginEmail&quot;
                          aria-label=&quot;Email&quot;
                          type=&quot;email&quot;
                          maxlength=&quot;64&quot;
                          placeholder=&quot;&quot;
                          value=&quot;test@temail.com&quot;
                          data-dl='{&quot;event&quot;:&quot;change&quot;,&quot;da_track&quot;:&quot;true&quot;,&quot;interaction_only&quot;:&quot;true&quot;}'
                          _ngcontent-upe-c18=&quot;&quot;
                          autocapitalize=&quot;off&quot;
                          autocomplete=&quot;off&quot;
                          autocorrect=&quot;off&quot;
                      /&gt;
                      &lt;!----&gt;&lt;!----&gt;&lt;!----&gt;
                      &lt;span class=&quot;eye-span&quot; hidden=&quot;&quot; _ngcontent-upe-c18=&quot;&quot;&gt;
                          &lt;!----&gt;
                          &lt;em
                              class=&quot;icon icon-view icon-2x&quot;
                              ondragstart=&quot;return false&quot;
                              ondrop=&quot;return false&quot;
                              data-dl='{&quot;event&quot;:&quot;mousedown&quot;,&quot;da_track&quot;:&quot;true&quot;,&quot;event_type&quot;:&quot;Link Click&quot;,&quot;event_id&quot;:&quot;Show Password&quot;}'
                              _ngcontent-upe-c18=&quot;&quot;
                              alt=&quot;Show password&quot;
                          &gt;&lt;/em&gt;
                          &lt;!----&gt;
                      &lt;/span&gt;
                  &lt;/div&gt;
              &lt;/primary-text-input&gt;
          &lt;/div&gt;
          &lt;div class=&quot;col-xs-12 no-padding gotham-book&quot; _ngcontent-upe-c14=&quot;&quot;&gt;
              &lt;!----&gt;
              &lt;span class=&quot;icon icon-attention form-control-feedback&quot; aria-hidden=&quot;true&quot; _ngcontent-upe-c14=&quot;&quot;&gt;&lt;/span&gt;
              &lt;!----&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/primary-form-text-input&gt;
  </code></pre>
  
  <p>UPDATE: I think I found the jscript function</p>
  <pre><code>                function ar(e) {
                  return r[&quot;ɵvid&quot;](0, [(e()(), r[&quot;ɵeld&quot;](0, 0, [[1, 0], [&quot;name&quot;, 1]], null, 6, &quot;input&quot;, [[&quot;autocapitalize&quot;, &quot;off&quot;], [&quot;autocomplete&quot;, &quot;off&quot;], [&quot;autocorrect&quot;, &quot;off&quot;], [&quot;data-dl&quot;, '{&quot;event&quot;:&quot;change&quot;,&quot;da_track&quot;:&quot;true&quot;,&quot;interaction_only&quot;:&quot;true&quot;}']], [[8, &quot;type&quot;, 0], [8, &quot;placeholder&quot;, 0], [8, &quot;id&quot;, 0], [8, &quot;name&quot;, 0], [1, &quot;maxlength&quot;, 0], [1, &quot;minlength&quot;, 0], [1, &quot;max&quot;, 0], [8, &quot;className&quot;, 0], [1, &quot;aria-label&quot;, 0], [1, &quot;value&quot;, 0], [8, &quot;readOnly&quot;, 0], [2, &quot;ng-untouched&quot;, null], [2, &quot;ng-touched&quot;, null], [2, &quot;ng-pristine&quot;, null], [2, &quot;ng-dirty&quot;, null], [2, &quot;ng-valid&quot;, null], [2, &quot;ng-invalid&quot;, null], [2, &quot;ng-pending&quot;, null]], [[null, &quot;blur&quot;], [null, &quot;focus&quot;], [null, &quot;input&quot;], [null, &quot;compositionstart&quot;], [null, &quot;compositionend&quot;]], (function (e, t, n) {
                                      var i = !0,
                                      o = e.component;
                                      return &quot;input&quot; === t &amp;&amp; (i = !1 !== r[&quot;ɵnov&quot;](e, 1)._handleInput(n.target.value) &amp;&amp; i),
                                      &quot;blur&quot; === t &amp;&amp; (i = !1 !== r[&quot;ɵnov&quot;](e, 1).onTouched() &amp;&amp; i),
                                      &quot;compositionstart&quot; === t &amp;&amp; (i = !1 !== r[&quot;ɵnov&quot;](e, 1)._compositionStart() &amp;&amp; i),
                                      &quot;compositionend&quot; === t &amp;&amp; (i = !1 !== r[&quot;ɵnov&quot;](e, 1)._compositionEnd(n.target.value) &amp;&amp; i),
                                      &quot;blur&quot; === t &amp;&amp; (i = !1 !== o.onChange(n, r[&quot;ɵnov&quot;](e, 0).value) &amp;&amp; i),
                                      &quot;focus&quot; === t &amp;&amp; (i = !1 !== o.onFocusFunction() &amp;&amp; i),
                                      i
                                  }), null, null)), r[&quot;ɵdid&quot;](1, 16384, null, 0, Jn.DefaultValueAccessor, [r.Renderer2, r.ElementRef, [2, Jn.COMPOSITION_BUFFER_MODE]], null, null), r[&quot;ɵprd&quot;](1024, null, Jn.NG_VALUE_ACCESSOR, (function (e) {
                                  return [e]
                              }), [Jn.DefaultValueAccessor]), r[&quot;ɵdid&quot;](3, 540672, null, 0, Jn.FormControlDirective, [[8, null], [8, null], [6, Jn.NG_VALUE_ACCESSOR], [2, Jn[&quot;ɵangular_packages_forms_forms_q&quot;]]], {
                              form: [0, &quot;form&quot;]
                          }, null), r[&quot;ɵprd&quot;](2048, null, Jn.NgControl, null, [Jn.FormControlDirective]), r[&quot;ɵdid&quot;](5, 16384, null, 0, Jn.NgControlStatus, [[4, Jn.NgControl]], null, null), r[&quot;ɵdid&quot;](6, 4210688, null, 0, Kn, [Qn, er, r.ElementRef, $n], null, null)], (function (e, t) {
                          e(t, 3, 0, t.component.controls)
                      }), (function (e, t) {
                          var n = t.component;
                          e(t, 0, 1, [n.inputType, n.inputPlaceholder, n.inputId, n.inputId, n.maxlength, n.minlength, n.max, r[&quot;ɵinlineInterpolate&quot;](7, &quot;form-control &quot;, &quot;password&quot; === n.inputType ? &quot;set-password-eye-align&quot; : &quot;&quot;, &quot; &quot;, &quot;loginPassword&quot; === n.inputId ? &quot;login-password-star&quot; : &quot;&quot;, &quot; &quot;, &quot;email&quot; === n.inputId || &quot;securityCode&quot; === n.inputId ? &quot;gbx-unmasked&quot; : &quot;&quot;, &quot;&quot;, &quot;emailControl&quot; === n.inputId ? &quot;gbx-unmasked&quot; : &quot;&quot;, &quot;&quot;, &quot;loginEmail&quot; === n.inputId ? &quot;gbx-unmasked&quot; : &quot;&quot;, &quot;&quot;, &quot;firstName&quot; === n.inputId ? &quot;gbx-unmasked&quot; : &quot;&quot;, &quot;&quot;, &quot;lastName&quot; === n.inputId ? &quot;gbx-unmasked&quot; : &quot;&quot;, &quot;&quot;), n.labelName, n.inputValue, n.readOnlyCondition, r[&quot;ɵnov&quot;](t, 5).ngClassUntouched, r[&quot;ɵnov&quot;](t, 5).ngClassTouched, r[&quot;ɵnov&quot;](t, 5).ngClassPristine, r[&quot;ɵnov&quot;](t, 5).ngClassDirty, r[&quot;ɵnov&quot;](t, 5).ngClassValid, r[&quot;ɵnov&quot;](t, 5).ngClassInvalid, r[&quot;ɵnov&quot;](t, 5).ngClassPending])
                      }))
              }
  </code></pre>
  <p>How do I call it?</p>
  <p>I just remembered that this is a public website.</p>
  <p>Here is the <a href="https://account.thehartford.com/customer/#/login?appid=EE" rel="nofollow noreferrer">link</a>.</p>