• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

HTTP Unit and JavaScript

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I'm testing a web using HTTP Unit and I'm getting some problems with the Javascript in that site.

I want to submit a FORM which has 3 elements: one Textfield and two Option-Lists. The Textfield is just plain text and the first OPTION represents the months (01-12). So these two are quite easy to set, with the setParameter() method on form-object.

The problem is the second OPTION-List - which has some nasty Javascript which dynamicaly creates the drop-down values for the years:

for (i = 0; i < 11; i++) {
document.write("<option value='" + year + "'>" + year+ "</option>");
year++;
}

Can anybody tell me how to set this value so I can submit this FORM?
 
Pitt Quintence
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
... there is another Javascript in that site too, which evaluates the FORM when submitting it...
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've been told HTMLunit actually parses the javascript as well.
I think that would solve your problem.

htmlunit getting started
[ March 30, 2006: Message edited by: Richard Velden ]
 
Pitt Quintence
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi again

I've found the solution -
the problem was that the JScript was in the body of the page...
I moved it to the head modified it a little bit and called it
from the body and it works....

thanx anyway
perhaps this is helpful for somebody
 
What's wrong? Where are you going? Stop! Read this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic