Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select Item from Internet Drop-down List

Status
Not open for further replies.

BHo15

Technical User
Jan 20, 2014
4
0
0
US
I am running into a brick wall on this one. I need to select an item from a drop down list on a webpage, and then "save as" to a path on my computer. My attempts so far have the list selected, but I can't change its value (selection). AND, even if I did get its value selected, it will then have an isolated selection at the bottom of the page for "Do you want to open or save ____.pdf...?, with options to Open, Save (with another dropdown (Save, Save as, Save and Open), and Cancel. I don't know how to control either one of those drop downs.

For the first one, I have tried several different approaches including the following...

1) IE.Document.All.Item("MenuItem_DownloadPDF").Value="PDFDocDownload"
2) IE.document.getElementById("MenuItem_DownloadPDF").Value = "PDFDocDownload"
3)
Code:
For Each opt In ie.document.getElementById("MenuItem_DownloadPDF").Options
      If opt.Value = "PDFDocDownload" Then
         opt.Selected = True
      Else
         opt.Selected = False
      End If
Next
4) And finally, various SendKeys attempts.

I would LOVE any suggestions on what to try next.

Here is my code so far...

Code:
Set IE = CreateObject("InternetExplorer.Application")
With IE
  .Visible = 1 
  .navigate "[URL unfurl="true"]https://www.investors.com/secure/login.aspx?ns=mobile&placeholder=1#http%3a%2f%2fwww.investors.com%2fdefault.aspx"[/URL]
End With
Do While (IE.Busy)
    WScript.Sleep 10
Loop
Set IEDoc = IE.document.getElementByID("UserName")
IEDoc.Value = "myusername"
Set IEDoc = IE.document.getElementByID("Password")
IEDoc.Value = "mypw" 
Set IEDoc = IE.document.getElementByID("loginButton")
IEDoc.Click
Do While (IE.Busy)
	WScript.Sleep 10
Loop
Do While (IE.Busy)
	WScript.Sleep 10
Loop
WScript.Sleep (3000)
IE.navigate "[URL unfurl="true"]http://epaper.investors.com/olive/ode/ibd/"[/URL]
Do While (IE.Busy)
	WScript.Sleep 10
Loop
WScript.Sleep (8000)
Set IEDoc = IE.document.getElementById("MenuItem_DownloadPDF")
IEDoc.Click

AND... The HTML for the first drop down selection...

HTML:
<table owc:control="menu" class="popup-menu Hidden" owc:menutype="popup" cellspacing="0" cellpadding="0">
<tr owc:control="menuitem" owc:command="PDFDocDownload" class="MenuItemContent">
<td class="icon-cell"><img class="cmd-icon icon-DownloadPDF" src="styles/images/t.gif" alt=""/></td>
<td id="MenuItem_DownloadPDF"></td>
</tr>
<tr owc:control="menuitem" owc:command="SaveForOfflinePage" class="MenuItemContent">
<td class="icon-cell"><img class="cmd-icon icon-OfflineBrowsing" src="styles/images/t.gif" alt=""/></td>
<td id="MenuItem_Offline"></td>
</tr>
<tr owc:control="menuitem" owc:command="AddToFavorites" class="MenuItemContent">
<td class="icon-cell"><img class="cmd-icon icon-Bookmark" src="styles/images/t.gif" alt=""/></td>
<td id="MenuItem_Bookmark"></td>
</tr>
</table>

H-E-L-P Pretty Please! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top