• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Trying To Automate IE- populate text box and submit form...

TPN

New Member
Hello,

I am trying to automate Internet Explorer. I would like to populate a text box on a form and automatically click submit, then return a value that the website gives to Excel. I can not populate the text box and tried several things. I went on to trying to click the button too, but I cant even get that to happen.

I have a sheet with two columns as follows:

61367

In B2 I have a formula that I created(below) that is in a Module which loads IE and populates the page. Then I want to take the value of the domain name and place it into the input text box on the form, next I want to submit and wait for the value to come back.

Here is what I have tried:

Code:
Function getGDValue(strDomainName As String) As Currency

    Dim IE          As New InternetExplorer
    Dim doc         As HTMLDocument
    Dim allButtons  As Object
    Dim i           As Integer
    
    IE.Visible = True

    'GO TO THE GODADDY VALUATION PAGE
    IE.Navigate "https://www.godaddy.com/domain-value-appraisal"
    
    'WAIT FOR THE PAGE TO LOAD
    Do
        DoEvents
    Loop Until IE.LocationName = "Free Domain Value and Appraisal Tool | What is your domain worth? - - GoDaddy"
    
    Set doc = IE.document
    
    'PLACE THE DOMAIN NAME TO BE CHECKED INTO THE TEXT BOX
    IE.document.getElementsByTagName("domainToCheck") = strDomainName
    
    'FIND THE BUTTON TO SUBMIT
    Set allButtons = IE.document.getElementsByTagName("button")
    Do While i < allButtons.Length
        If allButtons(i).Type = "submit" And allButtons(i).Value = "btn btn-primary submit" Then
            allButtons(i).Click
            Exit Do
        End If
        i = i + 1
    Loop
  
    'GET THE ESTIMATED VALUE AND RETURN IT FROM THE CALL
    getGDValue = doc.getElementsByTagName("dpp-price price")(0).innerText
    
    'CLOSE IE AND CLEAN UP OBJECT
    IE.Quit
    Set IE = Nothing
    
    
End Function

Can anyone give me some tips as to why this isnt working?

Thanks!
Anthony
 
Update: I have been able to get past step 2! But now I am encountering a very odd problem. I am not sure if anyone else can duplicate this but once the "GoValue" button is clicked the returned screen is not what it should be. There is a standard Godaddy header and footer but the entire middle section which appears in other browsers (Chrome, Firefox) is missing. This is the section which returns the estimated value, comparative sales, etc.

So, my question is: is this something that I my code is causing to occur??

Here is my updated code and two screen shots
1) what the return screen should look like
2) what it looks like on IE.

Rich (BB code):
Sub Try3()

    Dim IE              As New InternetExplorer
    Dim doc             As HTMLDocument
    Dim objDomainIn     As HTMLInputElement
    Dim objGoButton     As HTMLButtonElement
    Dim objValueOut     As HTMLSpanElement
    
    IE.Visible = True

    'GO TO THE GODADDY VALUATION PAGE
    IE.Navigate "https://www.godaddy.com/domain-value-appraisal"
    
    'WAIT FOR THE PAGE TO LOAD
    Do
        DoEvents
    Loop Until IE.LocationName = "Free Domain Value and Appraisal Tool | What is your domain worth? - - GoDaddy"
    
    Set doc = IE.document

    'I WOULD LIKE TO DO THE FOLLOWING STEPS FOR SEVERAL HUNDRED DOMAIN NAMES. BUT FOR THIS EXAMPLE, HERE IS ONE OF NAMES:

    '1) insert the domain name into the "domainToCheck" textbox
    '2) click the "GoValue™" button
    '3) scrape the Estimated Value from the result page

    'SO TRANSLATING THOSE STEPS TO VBA I TRIED:

    'STEP 1)
    'THE INPUT TEXTBOX ON THE FORM:
    '<input name="domainToCheck" class="domain-name-input searchInput form-control" aria-label="Enter a domain name" type="text" placeholder="Enter a domain name" value="">
    Set objDomainIn = doc.getElementsByName("domainToCheck")(0)
    objDomainIn.Value = "MPGBooster.com"



    'STEP 2)
    'BUTTON THAT NEEDS TO BE AUTOMATICALLY CLICKED (I added carriage returns because it was very long):
    '<button class="btn btn-primary  submit    "
    ' type="Submit"
    ' data-eid="gce.sales.domain-value-appraisal.domain_search_marquee.domain_search_marquee_lp_module.button"
    ' data-creative-slot="e6a02371-14a2-4a21-b444-4aa0ae01b3b7"
    ' data-creative-name="domain-value-appraisal/Domain Search Marquee LP Module/Domain Search Block/Primary CTA"
    ' data-promo-name="domain_search_marquee.domain_search_marquee_lp_module.button8b002669-c11d-4913-881e-fe39fce24eab"
    ' data-promo-id="gce.sales.domain-value-appraisal."
    ' data-schema="add_promotion" data-tdata="module_id,e6a02371-14a2-4a21-b444-4aa0ae01b3b7^block_id,8b002669-c11d-4913-881e-fe39fce24eab^block_path,/ComponentSettings/GoDaddy/Sales/domain-value-appraisal/Domain Search Marquee LP Module/Domain Search Block/Primary CTA^campaign_name,^redpntcn,^redpntrid,^redpntcid,^redpntsn,^redpntrc,"
    ' value="GoValue™">GoValue™</button>
        
    'CLICK "GOVALUE" BUTTON TO GET DOMAINS VALUE
    Set objGoButton = doc.getElementsByClassName("btn btn-primary  submit    ")(0)
    objGoButton.click
    
    'STEP 3)
    'THE RETURNED HTML SHOWING THE DOMAIN ESTIMATED VALUE
    '<span class="dpp-price price"><strong>$1,426</strong></span>
    Set objValueOut = doc.getElementsByClassName("dpp-price price")
    MsgBox "MPGBooster.com valued at: " & objValueOut.innerText
 
    'CLEAN UP OBJECTS
    IE.Quit
    Set IE = Nothing
    
End Sub

Chrome properly returning estimated value:

61394


Internet Explorer 11 returning nothing:

61395
 
Hi !​
I had exactly same issue when browsing under IE with different laptops since your initial post.​
As this is a beta webpage so not well coded for IE, you may better find out another website …​
Edit : maybe the issue is now resolved (OK with one laptop), retry first browsing manually under IE.​
 
  • Like
Reactions: TPN
Still doesnt work for me. You mention something interesting - its beta. I didnt realize that. OK, is there a way to switch the browser VBA uses? Can I use Chrome or Firefox - or another? I've tried it in many browsers and it works but not in IE...
 
If you want to stay with this beta webpage under another webbrowser you must use the Seleniumbasic library.​
And in case of any issue with this library, better is to ask on a Selenium forum …​
 
  • Like
Reactions: TPN
Back
Top