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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with drop box list from IE

Status
Not open for further replies.

daillest319

Programmer
Apr 9, 2012
29
US
Hi,
I'm writing a vbs script to automate through a webpage.
I was hoping someone can help me with selecting from a drop box list from IE webpage.I'm able to change the value but its not submitting it or updating the page with the year i selected.


the source code on the web page is the following



Code:
  function doChange()
   {
   var wsub1,wsub2,wDate;
   wsub1 = document.JOBLISTFORM.month.selectedIndex;
   wsub2 = document.JOBLISTFORM.year.selectedIndex;
   wDate = document.JOBLISTFORM.year[wsub2].value +
<select id="YEAR" name=year size="1" onChange="doChange()">
          <option value="2001" >2001
          <option value="2002" >2002
          <option value="2003" >2003

   {
   var wsub1,wsub2,wDate;
   wsub1 = document.JOBLISTFORM.month.selectedIndex;
   wsub2 = document.JOBLISTFORM.year.selectedIndex;
   wDate = document.JOBLISTFORM.year[wsub2].value + document.JOBLISTFORM.month[wsub1].value + "01";
   CL(wDate);
   }

-----------------------------------------------------

This is the code im using to change the value and submit it change the value but it does not submit/update the page with the year i slected.....

Code:
Dim oIE
Set oIE = WScript.CreateObject("InternetExplorer.Application")
oIE.Document.Forms(0).Item("YEAR").Value = 2003
oIE.Document.Forms(0).Submit
 
Set oIE = WScript.CreateObject("InternetExplorer.Application") creates a new and empty instance of IE. Try populating it with [tt]oIE.navigate "[/tt] first.

- Geates


"I hope I can chill and see the change - stop the bleed inside and feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
I'm sorry i didnt pastee my whole code. i able to get the to page login and i see the value change in the drop list but it does not update/submit.


Code:
Dim oIE
Set oIE = WScript.CreateObject("InternetExplorer.Application")

oIE.Visible = true
oIE.Navigate("[URL unfurl="true"]http://www.test.com")[/URL]
WScript.Sleep 1000
oIE.Document.All.Item("usid").Value = "name"
oIE.Document.All.Item("pwid").Value = "pass" 
WScript.Sleep 1000
oIE.navigate("javascript:doSubmit('LOGIN')")
WScript.Sleep 2000
oIE.Document.Forms(0).Item("YEAR").Value = 2003
WScript.Sleep 2000
oIE.Document.Forms(0).Submit
 
The page may not be finished loading before you try to add the values. Try adding the code below immediately after each "Navigate" method call (two times in the code you just posted):
Code:
Do While IE.busy = True
	WScript.Sleep 100
Loop
 
i got it to work. i needed the following....

replaced
Code:
oIE.Document.Forms(0).Submit

with
Code:
oIE.navigate("javascript:doChange()")
 
hmm.. I don't understand how that submits the change.

-Geates

"I hope I can chill and see the change - stop the bleed inside and feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
From what is posted in this thread, Repost the doChange() function. What is [tt]CL(wDate)[/tt]? Is that a Common Lisp function?

-Geates

"I hope I can chill and see the change - stop the bleed inside and feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top