Re: [Httpunit-develop] not finding drop down form element....
Brought to you by:
russgold
From: Russell G. <rus...@ac...> - 2002-01-28 06:50:48
|
At 11:30 PM -0600 1/27/02, Jason Long wrote: >I am trying to use HttpUnit to log on to automatically log on to a web site >and perform a query. The logon work fine and then I get to the query page. >When I try to submit the query form with the following code I get and error >that com.meterware.httpunit.NoSuchParameterException: No parameter named >'vcountry' is defined in the form. This parameter is a dropdown and is >clearly within the form. Do anyone have any ideas why this would not be >working? > > > webRequest = regionSearchForm.getRequest(); > webRequest.setParameter( "lg", "1" ); > webRequest.setParameter( "vskp", "0" ); > webRequest.setParameter( "vktp", "region" ); > webRequest.setParameter( "vcountry", "United States" ); from the FAQ: HttpUnit is not finding the buttons and parameters in my forms. What is wrong? This often happens when your HTML is not valid. Most browsers are extremely forgiving of bad HTML; however, JTidy (the HTML parser used by HttpUnit) is not. It expects tags to be nested according to the HTML specification and will reject any that are not. JTidy can display error messages to tell you what is wrong. To see them, call HttpUnitOptions.setParserWarningsEnabled( true ) before retrieving your HTML page. Once you have corrected any errors, HttpUnit should see your form buttons and parameters. You can also call HttpUnitOptions.setParameterValuesValidated( false ) to ignore all such checks. -- ------------------------------------------------------------------------ Russell Gold | "... society is tradition and order rus...@ac... | and reverence, not a series of cheap | bargains between selfish interests." http://www.httpunit.org | - Poul Anderson, "Iron" |