Problem Auto filling a filed Vb script RRS feed

  • Question

  • Good evening All, I am having problem. I have a html page that I am testing automation on, in short, I am trying to auto fill the field with VB, the page has one field with a submit button.

    Here is the name field code

    <input ng-reflect-id="firstName" id="firstName" ng-reflect-type="text" type="text" ng-reflect-placeholder="Legal Name" placeholder="name" class="ng-pristine ng-valid ng-touched">

    Here is the Submit button code

    <button ng-reflect-type="submit" type="submit" ng-reflect-id="next_btn" id="next_btn" ng-reflect-class-name="btn mobile-primary margin-bottom-15" class="btn mobile-primary margin-bottom-15">

    and here is my Vb code.

        On Error Resume Next
    Const PAGE_LOADED = 4
    Set objIE = CreateObject("InternetExplorer.Application")
    Call objIE.Navigate("my page URL")
    objIE.Visible = True
    Do Until objIE.ReadyState = PAGE_LOADED : Call WScript.Sleep(100) : Loop
    objIE.Document.all.Item("firstName").Value = "Test"
    call objIE.Document.all.Item("next_btn").click
    Set objIE = Nothing

    Can someone please let me know why this code is not working? and by not working I mean, the field is not autofilling. the script works it navigates to my site with no problem but it does not auto fill the field.

    • Moved by Bill_Stewart Friday, July 27, 2018 8:25 PM Unanswerable drive-by question
    Tuesday, May 22, 2018 7:05 AM

All replies

  • That is not how the DOM works.  You must use "getElementById"

    objIE.Document.getElementById("Firstname").Value  = "Test"

    The HTML you posted is impossible as you cannot have two attributes with the same name.


    Tuesday, May 22, 2018 8:48 AM