Link to home
Start Free TrialLog in
Avatar of Jason_Haft
Jason_Haft

asked on

Scripting IE to use dropdown box in VB.Net using SHDocVw

I am trying to write a little program to download some stock prices.  This is an example of the webpage I am trying to hit:

http://www.nasdaq.com/symbol/aapl/historical

In the middle of the page you can see there is a dropdown that says "Select the Timeframe: ".  I would like to change this to 2 years with the program.  This is the code I am using:

Dim wbBrowser As New SHDocVw.InternetExplorer
        wbBrowser.Visible = True
        wbBrowser.Navigate("http://www.nasdaq.com/symbol/drys/historical", Nothing, Nothing, Nothing, Nothing)
        Do
        Loop Until Not wbBrowser.Busy

 Dim HTMLDoc As mshtml.HTMLDocument

HTMLDoc = wbBrowser.Document

 Dim iHTMLCol As IHTMLElementCollection
        Dim iHTMLEle As IHTMLElement
        Dim str As String

iHTMLCol = HTMLDoc.getElementsByTagName("input")

 If Not iHTMLEle.getAttribute("name") Is Nothing Then

     iHTMLEle.click()


 End if

Open in new window


I was really just using that to try to go through the page elements and find the dropdown, but I can't even find it.  Any ideas on how to interact with the dropdown?
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial