none
Problem Automating IE using "internetexplorer.application"

    Question

  • Hi Folks,

    I hope you can help me out... I'm trying to automate IE using "internetexplorer.application". I can successfully open IE and navigate to the web page (http://search.autotrader.co.za/www/WhatsWorth.jsp). I can even enumerate/select items in the "make" drop down list. So far so good.

    As you will see from the web site, when you select a make of car in the "make" list, the "model" list is dynamically updated. This works fine when browsing the web page manually and using the mouse to select an item in the list. Although I've figured out how to enumerate items in the make list and select a make programatically, I can't figure out how to force the web page to dynamically populate the contents of the second (model) list. It just remains empty.

    Can anyone provide code (VBA, VBscript or Powershell - I don't mind) to successfully select a make, model and year and then click the search button? My ultimate goal is to be able to retrieve the suggested values of numerous makes and models of cars automatically and write the results to a text file.

    FWIW, my Powershell code is below:

    $ie = new-object -com "InternetExplorer.Application"

    $ie.navigate("http://search.autotrader.co.za/www/WhatsWorth.jsp")

    $ie.visible = $true

    while ($ie.Busy -eq $true) { Start-Sleep -Milliseconds 1000; }

    $MakeList = $ie.Document.GetElementById("make")

    $MakeList.selectedIndex = 3

    $ModelList = $ie.Document.GetElementById("model")

    $ModelList.selectedIndex = 2

     

    Many thanks for your help!

    Lunk

    Thursday, February 03, 2011 1:07 AM

Answers

  • Contact autotrader.customer service to obtain written consent for transmit material from the web site. Then ask the autotrader if there is any better API than reverse engineering the web site.

    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP
    Thursday, February 03, 2011 11:21 PM